Skip to content

Commit

Permalink
Revert change on cache update, it doesn't give us anything
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Dec 19, 2024
1 parent 8909ffc commit 89aaa5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/stellar-rpc/internal/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ func getLatestLedgerSequence(ctx context.Context, ledgerReader LedgerReader, cac
// Add missing ledger sequence and close time to the top cache.
// Otherwise, the write-through cache won't get updated until the first ingestion commit
cache.Lock()
if cache.latestLedgerSeq == 0 || cache.latestLedgerSeq < ledgerRange.LastLedger.Sequence {
// Only update the cache if the value is missing or lower, otherwise
if cache.latestLedgerSeq == 0 {
// Only update the cache if the value is missing (0), otherwise
// we may end up overwriting the entry with an older version
cache.latestLedgerSeq = ledgerRange.LastLedger.Sequence
cache.latestLedgerCloseTime = ledgerRange.LastLedger.CloseTime
Expand Down

0 comments on commit 89aaa5e

Please sign in to comment.