Skip to content

Commit 15cf127

Browse files
authored
Merge pull request #91 from makeittotop/feat-add-idle-timeout-param
FEAT: Add IDLE_TIMEOUT config param, and update doc.
2 parents 3b5ab24 + e9131c7 commit 15cf127

File tree

6 files changed

+21
-1
lines changed

6 files changed

+21
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ log_level: warn
8686
# env: CT_TIMEOUT
8787
timeout: 10s
8888

89+
# HTTP request idle timeout
90+
# env: CT_IDLE_TIMEOUT
91+
idle_timeout: 60s
92+
8993
# Timeout to wait on shutdown to allow load balancers detect that we're going away.
9094
# During this period after the shutdown command the /alive endpoint will reply with HTTP 503.
9195
# Set to 0s to disable.

config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type config struct {
2222

2323
LogLevel string `yaml:"log_level" env:"CT_LOG_LEVEL"`
2424
Timeout time.Duration `env:"CT_TIMEOUT"`
25+
IdleTimeout time.Duration `yaml:"idle_timeout" env:"CT_IDLE_TIMEOUT"`
2526
TimeoutShutdown time.Duration `yaml:"timeout_shutdown" env:"CT_TIMEOUT_SHUTDOWN"`
2627
Concurrency int `env:"CT_CONCURRENCY"`
2728
Metadata bool `env:"CT_METADATA"`
@@ -89,6 +90,10 @@ func configLoad(file string) (*config, error) {
8990
cfg.Timeout = 10 * time.Second
9091
}
9192

93+
if cfg.IdleTimeout == 0 {
94+
cfg.IdleTimeout = 60 * time.Second
95+
}
96+
9297
if cfg.Concurrency == 0 {
9398
cfg.Concurrency = 512
9499
}

deploy/k8s/chart/values.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@
195195
"description": "HTTP request timeout",
196196
"format": "duration"
197197
},
198+
"idle_timeout": {
199+
"type": "string",
200+
"title": "Idle_Timeout",
201+
"description": "HTTP request idle timeout",
202+
"format": "duration"
203+
},
198204
"timeout_shutdown": {
199205
"type": "string",
200206
"title": "Shutdown timeout",

deploy/k8s/chart/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ config:
6565
# -- HTTP request timeout
6666
# (env: `CT_TIMEOUT`)
6767
timeout: 10s
68+
# -- HTTP request idle timeout
69+
# (env: `CT_IDLE_TIMEOUT`)
70+
idle_timeout: 60s
6871
# -- Timeout to wait on shutdown to allow load balancers detect that we're going away.
6972
# During this period after the shutdown command the /alive endpoint will reply with HTTP 503.
7073
# Set to 0s to disable.

deploy/k8s/manifests/config-file-configmap.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ data:
1717
log_level: warn
1818
# HTTP request timeout
1919
timeout: 10s
20+
# HTTP request idle timeout
21+
idle_timeout: 60s
2022
# Timeout to wait on shutdown to allow load balancers detect that we're going away.
2123
# During this period after the shutdown command the /alive endpoint will reply with HTTP 503.
2224
# Set to 0s to disable.

processor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func newProcessor(c config) *processor {
9797

9898
ReadTimeout: c.Timeout,
9999
WriteTimeout: c.Timeout,
100-
IdleTimeout: 60 * time.Second,
100+
IdleTimeout: c.IdleTimeout,
101101

102102
Concurrency: c.Concurrency,
103103
}

0 commit comments

Comments
 (0)