From e57ca0a40290e8106270da1ae8509d4b37a118a2 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Thu, 31 Oct 2024 08:16:05 -0400 Subject: [PATCH] add sleep for backoff Signed-off-by: Joe Elliott --- .../generator/processor/localblocks/processor.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/generator/processor/localblocks/processor.go b/modules/generator/processor/localblocks/processor.go index e0d9778a9ca..87363e016ee 100644 --- a/modules/generator/processor/localblocks/processor.go +++ b/modules/generator/processor/localblocks/processor.go @@ -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) + } + }() } } }