From 2ea8e388740a840b11bf5c5d06f698e2b9ed53d4 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Mon, 22 May 2023 23:24:27 +0200 Subject: [PATCH 1/2] feature: after_init option Signed-off-by: Valery Piashchynski --- pool/config.go | 3 +++ pool/static_pool/static_pool.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pool/config.go b/pool/config.go index f7dc2dd..5149226 100644 --- a/pool/config.go +++ b/pool/config.go @@ -13,6 +13,9 @@ type Config struct { // Command used to override the server command with the custom one Command string `mapstructure:"command"` + // AfterInitCommand command used to override the server's AfterInitCommand + AfterInitCommand string `mapstructure:"after_init_cmd"` + // NumWorkers defines how many sub-processes can be run at once. This value // might be doubled by Swapper while hot-swap. Defaults to number of CPU cores. NumWorkers uint64 `mapstructure:"num_workers"` diff --git a/pool/static_pool/static_pool.go b/pool/static_pool/static_pool.go index 48270f1..2619539 100755 --- a/pool/static_pool/static_pool.go +++ b/pool/static_pool/static_pool.go @@ -47,7 +47,7 @@ type Pool struct { } // NewPool creates new worker pool and task multiplexer. Pool will initiate with one worker. If supervisor configuration is provided -> pool will be turned into a supervisedExec mode -func NewPool(ctx context.Context, cmd pool.Command, factory pool.Factory, cfg *pool.Config, log *zap.Logger) (*Pool, error) { +func NewPool(ctx context.Context, cmd pool.Command, factory pool.Factory, cfg *pool.Config, log *zap.Logger, options ...Options) (*Pool, error) { if factory == nil { return nil, errors.Str("no factory initialized") } From b2bbcfae464d0c38934848587b47f64572610992 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Mon, 22 May 2023 23:32:18 +0200 Subject: [PATCH 2/2] chore: update config options Signed-off-by: Valery Piashchynski --- pool/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pool/config.go b/pool/config.go index 5149226..ad1ae00 100644 --- a/pool/config.go +++ b/pool/config.go @@ -14,7 +14,7 @@ type Config struct { Command string `mapstructure:"command"` // AfterInitCommand command used to override the server's AfterInitCommand - AfterInitCommand string `mapstructure:"after_init_cmd"` + AfterInitCommand string `mapstructure:"after_init"` // NumWorkers defines how many sub-processes can be run at once. This value // might be doubled by Swapper while hot-swap. Defaults to number of CPU cores.