add retry delay

This commit is contained in:
Nam Huynh 2021-10-18 14:20:20 +07:00
parent d98cd748d9
commit 98802f49fa
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package queue
import ( import (
"fmt" "fmt"
"time"
"github.com/hibiken/asynq" "github.com/hibiken/asynq"
) )
@ -37,6 +38,12 @@ func NewWorker(cfg Config) *asynq.ServeMux {
priorityLow: cfg.Priority.Low, priorityLow: cfg.Priority.Low,
}, },
StrictPriority: cfg.Priority.StrictMode, 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 // Init mux server