diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-26 09:09:19 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-26 09:14:14 +0000 |
| commit | 3f9843b34d7ae9df2dd9c69427ecab45744b97e9 (patch) | |
| tree | 1c667c17d77b43a1e5fbcae464068a74c2857fb5 /internal/config | |
| parent | dac676e8284725c8ec6de08282fe08a9b519ccc8 (diff) | |
feat: graceful shutdown — drain workers before exit (default 3m timeout)
- 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 <noreply@anthropic.com>
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 4 |
1 files changed, 3 insertions, 1 deletions
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"` |
