Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ func (p *processor) exec() {
if p.errLogLimiter.Allow() {
p.logger.Errorf("Dequeue error: %v", err)
}
// If Dequeue returns an error (e.g., Redis is unreachable),
// we should avoid busy-looping and consuming high CPU.
// Add a sleep here to slow down retry attempts.
// Without this, the processor will immediately retry Dequeue in a tight loop,
// causing high CPU usage when Redis is down.
jitter := rand.N(p.taskCheckInterval)
time.Sleep(p.taskCheckInterval/2 + jitter)
<-p.sema // release token
return
}
Expand Down