mirror of
https://github.com/hibiken/asynq.git
synced 2025-02-23 04:10:17 +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.
|
// Sleep to avoid slamming redis and let scheduler move tasks into queues.
|
||||||
// Note: We are not using blocking pop operation and polling queues instead.
|
// Note: We are not using blocking pop operation and polling queues instead.
|
||||||
// This adds significant load to redis.
|
// 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
|
<-p.sema // release token
|
||||||
return
|
return
|
||||||
case err != nil:
|
case err != nil:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user