From 31b3de2c96337d7148a4432a8745a9c1be27539d Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 3 Jun 2024 15:18:56 +0200 Subject: [PATCH] feat: shutdown_timeout == timeout by default --- internal/pkg/config/config.example.yaml | 3 ++- internal/pkg/config/config.go | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/pkg/config/config.example.yaml b/internal/pkg/config/config.example.yaml index 74d97fd..13c435b 100644 --- a/internal/pkg/config/config.example.yaml +++ b/internal/pkg/config/config.example.yaml @@ -25,7 +25,8 @@ runner: timeout: 3h # The timeout for the runner to wait for running jobs to finish when shutting down. # Any running jobs that haven't finished after this timeout will be cancelled. - shutdown_timeout: 0s + # Defaults to the same value as timeout if unset or 0. + shutdown_timeout: 3h # Whether skip verifying the TLS certificate of the instance. insecure: false # The timeout for fetching the job from the Forgejo instance. diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 5c260fb..a31af46 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -121,6 +121,9 @@ func LoadDefault(file string) (*Config, error) { if cfg.Runner.Timeout <= 0 { cfg.Runner.Timeout = 3 * time.Hour } + if cfg.Runner.ShutdownTimeout <= 0 { + cfg.Runner.ShutdownTimeout = cfg.Runner.Timeout + } if cfg.Cache.Enabled == nil { b := true cfg.Cache.Enabled = &b