Skip to content

Commit

Permalink
Add logging of when pruning happens and whether it was fully completed
Browse files Browse the repository at this point in the history
  • Loading branch information
reductionista committed Aug 22, 2024
1 parent a4216cd commit 33ad38b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/chains/evm/logpoller/log_poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,15 @@ func (lp *logPoller) backgroundWorkerRun() {
blockPruneTick = time.After(utils.WithJitter(lp.pollPeriod * 100))
}
case <-logPruneTick:
lp.lggr.Infof("Pruning LogPoller logs...")
logPruneTick = time.After(utils.WithJitter(lp.pollPeriod * 2401)) // = 7^5 avoids common factors with 1000
allRemoved, err := lp.PruneExpiredLogs(ctx)
if !allRemoved {
if allRemoved {
lp.lggr.Infof("Finished pruning LogPoller logs. Next pruning in ~ %s", lp.pollPeriod*2401)
} else {
// Tick faster when cleanup can't keep up with the pace of new logs
logPruneTick = time.After(utils.WithJitter(lp.pollPeriod * 241))
lp.lggr.Warnf("Partially finished pruning LogPoller logs. Will resume in ~ %s", lp.pollPeriod*241)
}
if err != nil {
lp.lggr.Errorw("Unable to prune expired logs", "err", err)
Expand Down

0 comments on commit 33ad38b

Please sign in to comment.