Skip to content

Commit 9e8095e

Browse files
xgopilotminorcell
andcommitted
fix(gateway): extend idle shutdown delay
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: minorcell <120795714+minorcell@users.noreply.github.com>
1 parent 13e5bb5 commit 9e8095e

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

internal/cli/gateway_commands.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
const (
2626
defaultGatewayLogLevel = "info"
27-
defaultGatewayIdleShutdownDelay = 30 * time.Second
27+
defaultGatewayIdleShutdownDelay = 5 * time.Minute
2828
)
2929

3030
var (
@@ -58,7 +58,7 @@ type gatewayCommandOptions struct {
5858

5959
MetricsEnabled bool
6060
MetricsEnabledOverridden bool
61-
SkipIPC bool
61+
SkipIPC bool
6262
}
6363

6464
// defaultNewAuthManager 创建默认网关认证器,并把具体持久化实现收敛在 CLI 装配层内部。

internal/cli/gateway_commands_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cli
22

33
import (
44
"testing"
5+
"time"
56

67
"github.com/spf13/cobra"
78
)
@@ -67,3 +68,10 @@ func TestMustReadInheritedWorkdir(t *testing.T) {
6768
}
6869
})
6970
}
71+
72+
func TestNewGatewayIdleShutdownControllerUsesExpectedDefaultTimeout(t *testing.T) {
73+
controller := newGatewayIdleShutdownController(nil, nil)
74+
if controller.idleTimeout != 5*time.Minute {
75+
t.Fatalf("idleTimeout = %v, want %v", controller.idleTimeout, 5*time.Minute)
76+
}
77+
}

0 commit comments

Comments
 (0)