From 2ea133966b3fe65e1a0c88c7ae2275563cb78fd2 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 2 Nov 2022 02:07:54 -0400 Subject: [PATCH] control pool size --- internal/cmd/worker.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/cmd/worker.go b/internal/cmd/worker.go index f57c392..514a8a8 100644 --- a/internal/cmd/worker.go +++ b/internal/cmd/worker.go @@ -58,8 +58,14 @@ func WorkerCmd(ctx context.Context) *cobra.Command { } defer redis.Close() + fp, err := cmdutil.NewFaktoryPool(poolSize + 2) + if err != nil { + return err + } + mgr := faktoryworker.NewManager() mgr.Concurrency = consumers + mgr.Pool = fp for queue, workerFn := range queues { worker := workerFn(ctx, logger, statsd, db, redis, consumers) mgr.Register(queue, worker.Process)