Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Commit 7596dbd

Browse files
authored
Merge pull request #21 from yepzdk/fix/issue-11-slow-shutdown
fix: close HTTP response bodies to eliminate slow shutdown
2 parents 83cde53 + ceade75 commit 7596dbd

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

internal/cli/run.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ background goroutine for the lifetime of the session.`,
9393

9494
// Register session with console
9595
client := session.DefaultConsoleClient(actualPort)
96-
client.Post("/api/sessions", map[string]string{
96+
if resp, err := client.Post("/api/sessions", map[string]string{
9797
"id": sessionID,
9898
"project": detectProject(),
99-
})
99+
}); err == nil && resp != nil {
100+
resp.Body.Close()
101+
}
100102

101103
// Build environment for Claude Code
102104
env := session.BuildEnv(sessionID, actualPort, issueFlag)
@@ -129,7 +131,9 @@ background goroutine for the lifetime of the session.`,
129131
exitErr := claudeCmd.Wait()
130132

131133
// End session in console
132-
client.Post(fmt.Sprintf("/api/sessions/%s/end", sessionID), nil)
134+
if resp, err := client.Post(fmt.Sprintf("/api/sessions/%s/end", sessionID), nil); err == nil && resp != nil {
135+
resp.Body.Close()
136+
}
133137

134138
// Stop console server
135139
srv.Stop()

internal/console/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (s *Server) Stop() error {
200200
if s.stopRetention != nil {
201201
s.stopRetention()
202202
}
203-
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
203+
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
204204
defer cancel()
205205
s.logger.Debug("console server stopping")
206206
if err := s.http.Shutdown(ctx); err != nil {

0 commit comments

Comments
 (0)