From 89aaa5e3d05d137eec1bbe17efa1652893b274e6 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Thu, 19 Dec 2024 21:04:15 +0100 Subject: [PATCH] Revert change on cache update, it doesn't give us anything --- cmd/stellar-rpc/internal/db/db.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/stellar-rpc/internal/db/db.go b/cmd/stellar-rpc/internal/db/db.go index fa25f1d7..8cd1fa25 100644 --- a/cmd/stellar-rpc/internal/db/db.go +++ b/cmd/stellar-rpc/internal/db/db.go @@ -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