Skip to content

Commit

Permalink
soroban-rpc: remove noisy rollback message (#1052)
Browse files Browse the repository at this point in the history
* remove noisy rollback message.

* update per feedback from golangci
  • Loading branch information
tsachiherman authored Oct 26, 2023
1 parent 1e42daf commit ff51660
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cmd/soroban-rpc/internal/ingest/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/stellar/go/historyarchive"
"github.com/stellar/go/ingest"
backends "github.com/stellar/go/ingest/ledgerbackend"
supportdb "github.com/stellar/go/support/db"
"github.com/stellar/go/support/log"
"github.com/stellar/go/xdr"

Expand Down Expand Up @@ -208,9 +209,14 @@ func (s *Service) fillEntriesFromCheckpoint(ctx context.Context, archive history
if err != nil {
return err
}
transactionCommitted := false
defer func() {
if err := tx.Rollback(); err != nil {
s.logger.WithError(err).Warn("could not rollback fillEntriesFromCheckpoint write transactions")
if !transactionCommitted {
// Internally, we might already have rolled back the transaction. We should
// not generate benign error/warning here in case the transaction was already rolled back.
if rollbackErr := tx.Rollback(); rollbackErr != nil && rollbackErr != supportdb.ErrAlreadyRolledback {
s.logger.WithError(rollbackErr).Warn("could not rollback fillEntriesFromCheckpoint write transactions")
}
}
}()

Expand All @@ -222,9 +228,12 @@ func (s *Service) fillEntriesFromCheckpoint(ctx context.Context, archive history
}

s.logger.Info("committing checkpoint ledger entries")
if err := tx.Commit(checkpointLedger); err != nil {
err = tx.Commit(checkpointLedger)
transactionCommitted = true
if err != nil {
return err
}

s.logger.Info("finished checkpoint processing")
return nil
}
Expand Down

0 comments on commit ff51660

Please sign in to comment.