Skip to content

Commit

Permalink
Fix typo from stellar#237
Browse files Browse the repository at this point in the history
I didn't adapt the logic right.

This was hard to debug because, in integration tests, it caused the
daemon to run `d.logger.WithError(err).Fatal("could not build
migrations")`, which in turn runs `os.Exit` which ends the test right
away (without flushing logs etc).

I need to think how to improve this. One option is to
override the `ExitFunc` in logrus with an assertion.
  • Loading branch information
2opremio committed Jul 8, 2024
1 parent 556d535 commit 03507be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/soroban-rpc/internal/db/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ func newGuardedDataMigration(
}
metaKey := "Migration" + uniqueMigrationName + "Done"
previouslyMigrated, err := getMetaBool(ctx, migrationDB, metaKey)
if err != nil && !errors.Is(err, ErrEmptyDB) {
if !errors.Is(err, ErrEmptyDB) {
err = errors.Join(err, migrationDB.Rollback())
return nil, err
}
latestLedger, err := NewLedgerEntryReader(db).GetLatestLedgerSequence(ctx)
if errors.Is(err, ErrEmptyDB) {
if !errors.Is(err, ErrEmptyDB) {
err = errors.Join(err, migrationDB.Rollback())
return nil, fmt.Errorf("failed to get latest ledger sequence: %w", err)
}
Expand Down

0 comments on commit 03507be

Please sign in to comment.