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) + } +}