Worker: move wait time into variable

No functional changes.
This commit is contained in:
Sybren A. Stüvel 2022-05-12 12:44:50 +02:00
parent 41d3c27c40
commit 9dbc952c09

View File

@ -15,8 +15,9 @@ import (
const ( const (
// How long to wait to fetch another task... // How long to wait to fetch another task...
durationNoTask = 2 * time.Second // ... if there is no task now. durationNoTask = 2 * time.Second // ... if there is no task now.
durationFetchFailed = 10 * time.Second // ... if fetching failed somehow. durationFetchFailed = 10 * time.Second // ... if fetching failed somehow.
durationTaskComplete = 2 * time.Second // ... when a task was completed.
) )
func (w *Worker) gotoStateAwake(ctx context.Context) { func (w *Worker) gotoStateAwake(ctx context.Context) {
@ -64,7 +65,7 @@ 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(2 * time.Second) time.Sleep(durationTaskComplete)
} }
} }