Skip to content

Commit

Permalink
Have the recoverer do nothing on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
ferglor committed Jun 27, 2024
1 parent 89346c5 commit fedb8cb
Showing 1 changed file with 47 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,53 +130,53 @@ func (r *logRecoverer) Start(ctx context.Context) error {
return r.StartOnce(LogRecovererServiceName, func() error {
r.updateBlockTime(ctx)

r.lggr.Infow("starting log recoverer", "blockTime", r.blockTime.Load(), "lookbackBlocks", r.lookbackBlocks.Load(), "interval", r.interval)

r.threadCtrl.Go(func(ctx context.Context) {
recoveryTicker := time.NewTicker(r.interval)
defer recoveryTicker.Stop()

for {
select {
case <-recoveryTicker.C:
if err := r.recover(ctx); err != nil {
r.lggr.Warnw("failed to recover logs", "err", err)
}
case <-ctx.Done():
return
}
}
})

r.threadCtrl.Go(func(ctx context.Context) {
cleanupTicker := time.NewTicker(utils.WithJitter(GCInterval))
defer cleanupTicker.Stop()

for {
select {
case <-cleanupTicker.C:
r.clean(ctx)
cleanupTicker.Reset(utils.WithJitter(GCInterval))
case <-ctx.Done():
return
}
}
})

r.threadCtrl.Go(func(ctx context.Context) {
blockTimeTicker := time.NewTicker(blockTimeUpdateCadence)
defer blockTimeTicker.Stop()

for {
select {
case <-blockTimeTicker.C:
r.updateBlockTime(ctx)
blockTimeTicker.Reset(utils.WithJitter(blockTimeUpdateCadence))
case <-ctx.Done():
return
}
}
})
r.lggr.Infow("starting no op log recoverer", "blockTime", r.blockTime.Load(), "lookbackBlocks", r.lookbackBlocks.Load(), "interval", r.interval)

//r.threadCtrl.Go(func(ctx context.Context) {
// recoveryTicker := time.NewTicker(r.interval)
// defer recoveryTicker.Stop()
//
// for {
// select {
// case <-recoveryTicker.C:
// if err := r.recover(ctx); err != nil {
// r.lggr.Warnw("failed to recover logs", "err", err)
// }
// case <-ctx.Done():
// return
// }
// }
//})
//
//r.threadCtrl.Go(func(ctx context.Context) {
// cleanupTicker := time.NewTicker(utils.WithJitter(GCInterval))
// defer cleanupTicker.Stop()
//
// for {
// select {
// case <-cleanupTicker.C:
// r.clean(ctx)
// cleanupTicker.Reset(utils.WithJitter(GCInterval))
// case <-ctx.Done():
// return
// }
// }
//})
//
//r.threadCtrl.Go(func(ctx context.Context) {
// blockTimeTicker := time.NewTicker(blockTimeUpdateCadence)
// defer blockTimeTicker.Stop()
//
// for {
// select {
// case <-blockTimeTicker.C:
// r.updateBlockTime(ctx)
// blockTimeTicker.Reset(utils.WithJitter(blockTimeUpdateCadence))
// case <-ctx.Done():
// return
// }
// }
//})

return nil
})
Expand Down

0 comments on commit fedb8cb

Please sign in to comment.