From 98802f49fa96837d4ee0765141e8ad6a513dd068 Mon Sep 17 00:00:00 2001 From: Nam Huynh Date: Mon, 18 Oct 2021 14:20:20 +0700 Subject: [PATCH] add retry delay --- worker.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/worker.go b/worker.go index 0a5b130..39d7092 100644 --- a/worker.go +++ b/worker.go @@ -2,6 +2,7 @@ package queue import ( "fmt" + "time" "github.com/hibiken/asynq" ) @@ -37,6 +38,12 @@ func NewWorker(cfg Config) *asynq.ServeMux { priorityLow: cfg.Priority.Low, }, StrictPriority: cfg.Priority.StrictMode, + + // TODO: + // This is default option, retry after 10s, will add to config later + RetryDelayFunc: func(n int, e error, t *asynq.Task) time.Duration { + return 10 * time.Second + }, }) // Init mux server