[Update] Change name config in struct

This commit is contained in:
trunglt251292 2022-02-16 17:56:22 +07:00
parent 1e8c775bb6
commit 7c1ecfa89c
2 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@ type Instance struct {
Server *asynq.ServeMux Server *asynq.ServeMux
Scheduler *asynq.Scheduler Scheduler *asynq.Scheduler
Configs Config Config Config
} }
var instance Instance var instance Instance
@ -31,7 +31,7 @@ func NewInstance(cfg Config) Instance {
instance.Server = initServer(redisConn, cfg) instance.Server = initServer(redisConn, cfg)
instance.Scheduler = initScheduler(redisConn) instance.Scheduler = initScheduler(redisConn)
instance.Client = initClient(redisConn) instance.Client = initClient(redisConn)
instance.Configs = cfg instance.Config = cfg
// Return instance // Return instance
return instance return instance

View File

@ -28,8 +28,8 @@ func (i Instance) RunTask(typename string, payload []byte, priority string, retr
options = append(options, asynq.MaxRetry(retryTimes)) options = append(options, asynq.MaxRetry(retryTimes))
// Task timeout // Task timeout
if i.Configs.TaskTimeout != 0 { if i.Config.TaskTimeout != 0 {
options = append(options, asynq.Timeout(i.Configs.TaskTimeout)) options = append(options, asynq.Timeout(i.Config.TaskTimeout))
} }
// Enqueue task // Enqueue task