control pool size

This commit is contained in:
Andre Medeiros 2022-11-02 02:07:54 -04:00
parent 2b81f4c59f
commit 2ea133966b

View file

@ -58,8 +58,14 @@ func WorkerCmd(ctx context.Context) *cobra.Command {
} }
defer redis.Close() defer redis.Close()
fp, err := cmdutil.NewFaktoryPool(poolSize + 2)
if err != nil {
return err
}
mgr := faktoryworker.NewManager() mgr := faktoryworker.NewManager()
mgr.Concurrency = consumers mgr.Concurrency = consumers
mgr.Pool = fp
for queue, workerFn := range queues { for queue, workerFn := range queues {
worker := workerFn(ctx, logger, statsd, db, redis, consumers) worker := workerFn(ctx, logger, statsd, db, redis, consumers)
mgr.Register(queue, worker.Process) mgr.Register(queue, worker.Process)