fix(web): address latest Copilot review points

This commit is contained in:
lc6464
2026-04-14 23:39:59 +08:00
parent 79f87d151e
commit 0bb9bedc44
4 changed files with 47 additions and 15 deletions
+5 -4
View File
@@ -35,9 +35,6 @@ func shutdownApp() {
}
if len(servers) > 0 {
ctx, cancel := context.WithTimeout(context.Background(), shutdownTimeout)
defer cancel()
for _, srv := range servers {
if srv == nil {
continue
@@ -46,7 +43,11 @@ func shutdownApp() {
// Disable keep-alive to allow graceful shutdown
srv.SetKeepAlivesEnabled(false)
if err := srv.Shutdown(ctx); err != nil {
ctx, cancel := context.WithTimeout(context.Background(), shutdownTimeout)
err := srv.Shutdown(ctx)
cancel()
if err != nil {
// Context deadline exceeded is expected if there are active connections
// This is not necessarily an error, so log it at info level
if errors.Is(err, context.DeadlineExceeded) {
+2 -2
View File
@@ -298,7 +298,7 @@ func launcherConsoleHostsWithLocalAddrs(
return hosts
}
func launcherConsoleHosts(_ []string, hostInput string, public bool) []string {
func launcherConsoleHosts(hostInput string, public bool) []string {
return launcherConsoleHostsWithLocalAddrs(
hostInput,
public,
@@ -572,7 +572,7 @@ func main() {
// Print startup banner and token (console mode only).
if enableConsole || debug {
consoleHosts := launcherConsoleHosts(openResult.BindHosts, hostInput, effectivePublic)
consoleHosts := launcherConsoleHosts(hostInput, effectivePublic)
fmt.Print(utils.Banner)
fmt.Println()