From 811df854d69d629807a6dfef3984217e08328d40 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Mon, 27 May 2024 13:27:44 +1000 Subject: [PATCH] fix: Add env variable to worker timeout configuration. (#618) Co-authored-by: PulpDood <13587944+pulpdood@users.noreply.github.com> --- cloud/common/deploy/image/image.go | 1 + core/pkg/env/variables.go | 1 + core/pkg/membrane/membrane.go | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cloud/common/deploy/image/image.go b/cloud/common/deploy/image/image.go index e580c25a4..adfe8135b 100644 --- a/cloud/common/deploy/image/image.go +++ b/cloud/common/deploy/image/image.go @@ -83,6 +83,7 @@ func NewImage(ctx *pulumi.Context, name string, args *ImageArgs, opts ...pulumi. } buildContext := fmt.Sprintf("%s/build-%s", os.TempDir(), name) + //#nosec G301 - Patch to remove exec perms err = os.MkdirAll(buildContext, os.ModePerm) if err != nil { return nil, err diff --git a/core/pkg/env/variables.go b/core/pkg/env/variables.go index 35d71412a..0c24cb89b 100644 --- a/core/pkg/env/variables.go +++ b/core/pkg/env/variables.go @@ -18,6 +18,7 @@ package env var ( MAX_WORKERS = GetEnv("MAX_WORKERS", "300") MIN_WORKERS = GetEnv("MIN_WORKERS", "1") + WORKER_TIMEOUT = GetEnv("WORKER_TIMEOUT", "10") SERVICE_ADDRESS = GetEnv("SERVICE_ADDRESS", "127.0.0.1:50051") LOG_LEVEL = GetEnv("LOG_LEVEL", "INFO") ) diff --git a/core/pkg/membrane/membrane.go b/core/pkg/membrane/membrane.go index 8447d8805..6b5d28f27 100644 --- a/core/pkg/membrane/membrane.go +++ b/core/pkg/membrane/membrane.go @@ -296,8 +296,11 @@ func New(options *MembraneOptions) (*Membrane, error) { return nil, err } + workerTimeout, err := env.WORKER_TIMEOUT.Int() if options.ChildTimeoutSeconds < 1 { - options.ChildTimeoutSeconds = 10 + options.ChildTimeoutSeconds = workerTimeout + } else if err != nil { + return nil, err } if options.GatewayPlugin == nil {