From 1c2bd60e409ed7882b222e83614e57a366b8b78e Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Fri, 10 May 2024 04:08:42 +0200 Subject: [PATCH] Correctly report row iteration errors in StreamAllLedgers Also, improve in-memory loading logs. --- cmd/soroban-rpc/internal/daemon/daemon.go | 6 +++--- cmd/soroban-rpc/internal/db/ledger.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/soroban-rpc/internal/daemon/daemon.go b/cmd/soroban-rpc/internal/daemon/daemon.go index c2c224de..b09a948d 100644 --- a/cmd/soroban-rpc/internal/daemon/daemon.go +++ b/cmd/soroban-rpc/internal/daemon/daemon.go @@ -224,14 +224,14 @@ func MustNew(cfg *config.Config) *Daemon { } return nil }) + if err != nil { + logger.WithError(err).Fatal("could not obtain txmeta cache from the database") + } if currentSeq != 0 { logger.WithFields(supportlog.F{ "seq": currentSeq, }).Info("finished initializing in-memory store") } - if err != nil { - logger.WithError(err).Fatal("could not obtain txmeta cache from the database") - } onIngestionRetry := func(err error, dur time.Duration) { logger.WithError(err).Error("could not run ingestion. Retrying") diff --git a/cmd/soroban-rpc/internal/db/ledger.go b/cmd/soroban-rpc/internal/db/ledger.go index 1b4b0aa2..e0bf7fd1 100644 --- a/cmd/soroban-rpc/internal/db/ledger.go +++ b/cmd/soroban-rpc/internal/db/ledger.go @@ -49,7 +49,7 @@ func (r ledgerReader) StreamAllLedgers(ctx context.Context, f StreamLedgerFn) er return err } } - return nil + return q.Err() } // GetLedger fetches a single ledger from the db.