From 9dbc952c09f7fdf8d6fda670f991959bf57653fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 12 May 2022 12:44:50 +0200 Subject: [PATCH] Worker: move wait time into variable No functional changes. --- internal/worker/state_awake.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/worker/state_awake.go b/internal/worker/state_awake.go index 1df44981..99efdc94 100644 --- a/internal/worker/state_awake.go +++ b/internal/worker/state_awake.go @@ -15,8 +15,9 @@ import ( const ( // How long to wait to fetch another task... - durationNoTask = 2 * time.Second // ... if there is no task now. - durationFetchFailed = 10 * time.Second // ... if fetching failed somehow. + durationNoTask = 2 * time.Second // ... if there is no task now. + durationFetchFailed = 10 * time.Second // ... if fetching failed somehow. + durationTaskComplete = 2 * time.Second // ... when a task was completed. ) 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. - time.Sleep(2 * time.Second) + time.Sleep(durationTaskComplete) } }