mirror of
https://github.com/hibiken/asynq.git
synced 2024-11-14 11:31:18 +08:00
Add jitter on the processor fetch backoff sleep (#868)
This commit is contained in:
parent
f4b56498f2
commit
95a0768ae0
@ -181,7 +181,8 @@ func (p *processor) exec() {
|
||||
// Sleep to avoid slamming redis and let scheduler move tasks into queues.
|
||||
// Note: We are not using blocking pop operation and polling queues instead.
|
||||
// This adds significant load to redis.
|
||||
time.Sleep(p.taskCheckInterval)
|
||||
jitter := time.Duration(rand.Intn(int(p.taskCheckInterval)))
|
||||
time.Sleep(p.taskCheckInterval/2 + jitter)
|
||||
<-p.sema // release token
|
||||
return
|
||||
case err != nil:
|
||||
|
Loading…
Reference in New Issue
Block a user