Skip to content

Commit

Permalink
add sleep for backoff
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Elliott <[email protected]>
  • Loading branch information
joe-elliott committed Oct 31, 2024
1 parent ec38e50 commit e57ca0a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions modules/generator/processor/localblocks/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,15 @@ func (p *Processor) flushLoop() {
_ = level.Info(p.logger).Log("msg", "re-queueing block for flushing", "block", op.blockID, "attempts", op.attempts)
metricFailedFlushes.Inc()

op.at = time.Now().Add(op.backoff())
if _, err := p.flushqueue.Enqueue(op); err != nil {
_ = level.Error(p.logger).Log("msg", "failed to requeue block for flushing", "err", err)
}
delay := op.backoff()
op.at = time.Now().Add(delay)

go func() {
time.Sleep(delay)
if _, err := p.flushqueue.Enqueue(op); err != nil {
_ = level.Error(p.logger).Log("msg", "failed to requeue block for flushing", "err", err)
}
}()
}
}
}
Expand Down

0 comments on commit e57ca0a

Please sign in to comment.