fix: asynq concurrency set to cpu num
This commit is contained in:
parent
802ce46f7f
commit
55f76636fd
@ -6,10 +6,12 @@ import (
|
|||||||
"git.0x7f.app/WOJ/woj-server/internal/misc/config"
|
"git.0x7f.app/WOJ/woj-server/internal/misc/config"
|
||||||
"git.0x7f.app/WOJ/woj-server/internal/misc/log"
|
"git.0x7f.app/WOJ/woj-server/internal/misc/log"
|
||||||
"git.0x7f.app/WOJ/woj-server/internal/model"
|
"git.0x7f.app/WOJ/woj-server/internal/model"
|
||||||
|
"git.0x7f.app/WOJ/woj-server/pkg/utils"
|
||||||
"git.0x7f.app/WOJ/woj-server/pkg/zapasynq"
|
"git.0x7f.app/WOJ/woj-server/pkg/zapasynq"
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
"github.com/samber/do"
|
"github.com/samber/do"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RunRunner(i *do.Injector) error {
|
func RunRunner(i *do.Injector) error {
|
||||||
@ -32,7 +34,7 @@ func RunRunner(i *do.Injector) error {
|
|||||||
DB: conf.Redis.QueueDb,
|
DB: conf.Redis.QueueDb,
|
||||||
},
|
},
|
||||||
asynq.Config{
|
asynq.Config{
|
||||||
Concurrency: 1, // there's a worker pool in runner service
|
Concurrency: utils.If(runtime.NumCPU() > 1, runtime.NumCPU()-1, 1),
|
||||||
Logger: zapasynq.New(rlog),
|
Logger: zapasynq.New(rlog),
|
||||||
Queues: map[string]int{model.QueueRunner: 1},
|
Queues: map[string]int{model.QueueRunner: 1},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user