mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix(web): address latest Copilot review points
This commit is contained in:
@@ -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
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user