Worker: Avoid sleep at shutdown
Make the sleep between fetching tasks interruptable, so that a shutdown doesn't have to wait a few seconds.
This commit is contained in:
parent
9ab41984ac
commit
5bc94101e8
@ -90,7 +90,11 @@ func (w *Worker) runStateAwake(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do some rate limiting. This is mostly useful while developing.
|
// Do some rate limiting. This is mostly useful while developing.
|
||||||
time.Sleep(durationTaskComplete)
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
|
case <-time.After(durationTaskComplete):
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user