Skip to content

Commit

Permalink
check cache for nil (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-rash authored Feb 28, 2024
1 parent cff31f7 commit 54cef34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/globalservice/event_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ func (srv *GlobalService) GetMyCatalogs(myAccountKey string) ([]models.CatalogSh
to := tokens[3]
catalog := tokens[4]
online := srv.IsCatalogOnline(catalog)
ret := srv.CatalogRevision(catalog)
rev := srv.CatalogRevision(catalog)

if from == myAccountKey || to == myAccountKey {
summaries = append(summaries, models.CatalogShareSummary{
FromAccount: from,
ToAccount: to,
Catalog: catalog,
CatalogOnline: online,
Revision: ret,
Revision: rev,
})
}
}
Expand Down
3 changes: 3 additions & 0 deletions internal/globalservice/hb.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ func (srv *GlobalService) IsCatalogOnline(catalog string) bool {

func (srv *GlobalService) CatalogRevision(catalog string) int64 {
c := srv.hbCache.Get(catalog)
if c == nil {
return 0
}
return c.Value().Revision
}

Expand Down

0 comments on commit 54cef34

Please sign in to comment.