Skip to content

Commit

Permalink
Less restrictive approach to the replay, booting Oracle even if the r…
Browse files Browse the repository at this point in the history
…eplay fails (#747)
  • Loading branch information
mateusz-sekara committed Apr 25, 2024
1 parent 35f0bc5 commit aebcb45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,12 @@ func (r *BackfilledOracle) Run() {
errMu.Lock()
err = multierr.Combine(err, dstReplayErr)
errMu.Unlock()
r.lggr.Infow("finished replaying dst chain", "time", time.Since(s))
r.lggr.Infow("finished replaying dst chain", "time", time.Since(s))
}()
}
wg.Wait()
if err != nil {
r.lggr.Errorw("unexpected error replaying", "err", err)
return
r.lggr.Criticalw("unexpected error replaying, continuing plugin boot without all the logs backfilled", "err", err)
}
if err := ctx.Err(); err != nil {
r.lggr.Errorw("context already cancelled", "err", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ func TestBackfilledOracle(t *testing.T) {
job2.Run()
assert.True(t, job2.IsRunning())

/// Replay fails, so no Start()
/// Replay fails, but it starts anyway
lp11 := lpmocks.NewLogPoller(t)
lp12 := lpmocks.NewLogPoller(t)
lp11.On("Replay", mock.Anything, int64(1)).Return(errors.New("Replay failed")).Once()
lp12.On("Replay", mock.Anything, int64(2)).Return(errors.New("Replay failed")).Once()

oracle := jobmocks.NewServiceCtx(t)
oracle.On("Start", mock.Anything).Return(nil).Once()
job3 := NewBackfilledOracle(logger.NullLogger, lp11, lp12, 1, 2, oracle)
job3.Run()
assert.False(t, job3.IsRunning())
assert.True(t, job3.IsRunning())
}

0 comments on commit aebcb45

Please sign in to comment.