From e9131c7c7e84b408fcd5cd58cad008ead358c1ec Mon Sep 17 00:00:00 2001 From: Abhishek Pareek Date: Mon, 14 Jul 2025 11:10:45 -0700 Subject: [PATCH] Add IDLE_TIMEOUT config param, and update doc. --- README.md | 4 ++++ config.go | 5 +++++ deploy/k8s/chart/values.schema.json | 6 ++++++ deploy/k8s/chart/values.yaml | 3 +++ deploy/k8s/manifests/config-file-configmap.yml | 2 ++ processor.go | 2 +- 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 02aef25..ace3bcb 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,10 @@ log_level: warn # env: CT_TIMEOUT timeout: 10s +# HTTP request idle timeout +# env: CT_IDLE_TIMEOUT +idle_timeout: 60s + # Timeout to wait on shutdown to allow load balancers detect that we're going away. # During this period after the shutdown command the /alive endpoint will reply with HTTP 503. # Set to 0s to disable. diff --git a/config.go b/config.go index 872d508..aab45ca 100644 --- a/config.go +++ b/config.go @@ -22,6 +22,7 @@ type config struct { LogLevel string `yaml:"log_level" env:"CT_LOG_LEVEL"` Timeout time.Duration `env:"CT_TIMEOUT"` + IdleTimeout time.Duration `yaml:"idle_timeout" env:"CT_IDLE_TIMEOUT"` TimeoutShutdown time.Duration `yaml:"timeout_shutdown" env:"CT_TIMEOUT_SHUTDOWN"` Concurrency int `env:"CT_CONCURRENCY"` Metadata bool `env:"CT_METADATA"` @@ -89,6 +90,10 @@ func configLoad(file string) (*config, error) { cfg.Timeout = 10 * time.Second } + if cfg.IdleTimeout == 0 { + cfg.IdleTimeout = 60 * time.Second + } + if cfg.Concurrency == 0 { cfg.Concurrency = 512 } diff --git a/deploy/k8s/chart/values.schema.json b/deploy/k8s/chart/values.schema.json index 6b9f24e..cb0f059 100644 --- a/deploy/k8s/chart/values.schema.json +++ b/deploy/k8s/chart/values.schema.json @@ -195,6 +195,12 @@ "description": "HTTP request timeout", "format": "duration" }, + "idle_timeout": { + "type": "string", + "title": "Idle_Timeout", + "description": "HTTP request idle timeout", + "format": "duration" + }, "timeout_shutdown": { "type": "string", "title": "Shutdown timeout", diff --git a/deploy/k8s/chart/values.yaml b/deploy/k8s/chart/values.yaml index 616cc0a..f12f409 100644 --- a/deploy/k8s/chart/values.yaml +++ b/deploy/k8s/chart/values.yaml @@ -65,6 +65,9 @@ config: # -- HTTP request timeout # (env: `CT_TIMEOUT`) timeout: 10s + # -- HTTP request idle timeout + # (env: `CT_IDLE_TIMEOUT`) + idle_timeout: 60s # -- Timeout to wait on shutdown to allow load balancers detect that we're going away. # During this period after the shutdown command the /alive endpoint will reply with HTTP 503. # Set to 0s to disable. diff --git a/deploy/k8s/manifests/config-file-configmap.yml b/deploy/k8s/manifests/config-file-configmap.yml index a1a963a..84453a4 100644 --- a/deploy/k8s/manifests/config-file-configmap.yml +++ b/deploy/k8s/manifests/config-file-configmap.yml @@ -17,6 +17,8 @@ data: log_level: warn # HTTP request timeout timeout: 10s + # HTTP request idle timeout + idle_timeout: 60s # Timeout to wait on shutdown to allow load balancers detect that we're going away. # During this period after the shutdown command the /alive endpoint will reply with HTTP 503. # Set to 0s to disable. diff --git a/processor.go b/processor.go index bce0adf..959f4d6 100644 --- a/processor.go +++ b/processor.go @@ -97,7 +97,7 @@ func newProcessor(c config) *processor { ReadTimeout: c.Timeout, WriteTimeout: c.Timeout, - IdleTimeout: 60 * time.Second, + IdleTimeout: c.IdleTimeout, Concurrency: c.Concurrency, }