From 9e8095ee9bbb1a9a256a3e889119972c1619ecf7 Mon Sep 17 00:00:00 2001 From: xgopilot Date: Thu, 7 May 2026 18:45:46 +0000 Subject: [PATCH] fix(gateway): extend idle shutdown delay Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: minorcell <120795714+minorcell@users.noreply.github.com> --- internal/cli/gateway_commands.go | 4 ++-- internal/cli/gateway_commands_test.go | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/cli/gateway_commands.go b/internal/cli/gateway_commands.go index 7ef023cf..ad136989 100644 --- a/internal/cli/gateway_commands.go +++ b/internal/cli/gateway_commands.go @@ -24,7 +24,7 @@ import ( const ( defaultGatewayLogLevel = "info" - defaultGatewayIdleShutdownDelay = 30 * time.Second + defaultGatewayIdleShutdownDelay = 5 * time.Minute ) var ( @@ -58,7 +58,7 @@ type gatewayCommandOptions struct { MetricsEnabled bool MetricsEnabledOverridden bool - SkipIPC bool + SkipIPC bool } // defaultNewAuthManager 创建默认网关认证器,并把具体持久化实现收敛在 CLI 装配层内部。 diff --git a/internal/cli/gateway_commands_test.go b/internal/cli/gateway_commands_test.go index 27b8f0af..fa18d72c 100644 --- a/internal/cli/gateway_commands_test.go +++ b/internal/cli/gateway_commands_test.go @@ -2,6 +2,7 @@ package cli import ( "testing" + "time" "github.com/spf13/cobra" ) @@ -67,3 +68,10 @@ func TestMustReadInheritedWorkdir(t *testing.T) { } }) } + +func TestNewGatewayIdleShutdownControllerUsesExpectedDefaultTimeout(t *testing.T) { + controller := newGatewayIdleShutdownController(nil, nil) + if controller.idleTimeout != 5*time.Minute { + t.Fatalf("idleTimeout = %v, want %v", controller.idleTimeout, 5*time.Minute) + } +}