From 94285c0aadc49892eaadf81a2d4625c01e18d5d9 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Thu, 26 Sep 2024 14:31:42 -0700 Subject: [PATCH] #5412: review feedback on loop logic --- ingest/cdp/producer.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ingest/cdp/producer.go b/ingest/cdp/producer.go index d9395fbfbc..44cc7d3a6d 100644 --- a/ingest/cdp/producer.go +++ b/ingest/cdp/producer.go @@ -3,7 +3,6 @@ package cdp import ( "context" "fmt" - "math" "time" "github.com/prometheus/client_golang/prometheus" @@ -130,14 +129,9 @@ func PublishFromBufferedStorageBackend(ledgerRange ledgerbackend.Range, } from := ordered.Max(2, ledgerRange.From()) - to := ledgerRange.To() - if !ledgerRange.Bounded() { - to = math.MaxUint32 - } - ledgerBackend.PrepareRange(ctx, ledgerRange) - for ledgerSeq := from; ledgerSeq <= to; ledgerSeq++ { + for ledgerSeq := from; ledgerSeq <= ledgerRange.To() || !ledgerRange.Bounded(); ledgerSeq++ { var ledgerCloseMeta xdr.LedgerCloseMeta logger.WithField("sequence", ledgerSeq).Info("Requesting ledger from the backend...")