From 3f9843b34d7ae9df2dd9c69427ecab45744b97e9 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Thu, 26 Mar 2026 09:09:19 +0000 Subject: feat: graceful shutdown — drain workers before exit (default 3m timeout) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add workerWg to Pool; Shutdown() closes workCh and waits for all in-flight execute/executeResume goroutines to finish - Signal handler now shuts down HTTP first, then drains the pool - ShutdownTimeout config field (toml: shutdown_timeout); default 3m - Tests: WaitsForWorkers and TimesOut Co-Authored-By: Claude Sonnet 4.6 --- internal/config/config.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'internal/config') diff --git a/internal/config/config.go b/internal/config/config.go index 428712f..71258c1 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "time" "github.com/BurntSushi/toml" ) @@ -25,7 +26,8 @@ type Config struct { GeminiBinaryPath string `toml:"gemini_binary_path"` ClaudeImage string `toml:"claude_image"` GeminiImage string `toml:"gemini_image"` - MaxConcurrent int `toml:"max_concurrent"` + MaxConcurrent int `toml:"max_concurrent"` + ShutdownTimeout time.Duration `toml:"shutdown_timeout"` DefaultTimeout string `toml:"default_timeout"` ServerAddr string `toml:"server_addr"` WebhookURL string `toml:"webhook_url"` -- cgit v1.2.3