[Update] Add task timeout #1
|
@ -13,7 +13,7 @@ type Instance struct {
|
|||
Server *asynq.ServeMux
|
||||
Scheduler *asynq.Scheduler
|
||||
|
||||
Configs Config
|
||||
Config Config
|
||||
}
|
||||
|
||||
var instance Instance
|
||||
|
@ -31,7 +31,7 @@ func NewInstance(cfg Config) Instance {
|
|||
instance.Server = initServer(redisConn, cfg)
|
||||
instance.Scheduler = initScheduler(redisConn)
|
||||
instance.Client = initClient(redisConn)
|
||||
instance.Configs = cfg
|
||||
instance.Config = cfg
|
||||
|
||||
// Return instance
|
||||
return instance
|
||||
|
|
4
task.go
4
task.go
|
@ -28,8 +28,8 @@ func (i Instance) RunTask(typename string, payload []byte, priority string, retr
|
|||
options = append(options, asynq.MaxRetry(retryTimes))
|
||||
|
||||
// Task timeout
|
||||
if i.Configs.TaskTimeout != 0 {
|
||||
options = append(options, asynq.Timeout(i.Configs.TaskTimeout))
|
||||
if i.Config.TaskTimeout != 0 {
|
||||
options = append(options, asynq.Timeout(i.Config.TaskTimeout))
|
||||
}
|
||||
|
||||
// Enqueue task
|
||||
|
|
Loading…
Reference in New Issue