fix: add timeout to daemon request context to prevent indefinite hangs
reqCtx() now applies the server's requestTimeout (default 30s) to the context returned for request handlers. This prevents bd list and other commands from hanging indefinitely when database operations stall. The fix ensures: - All RPC handlers get a context with a deadline - Database operations (using QueryContext) honor context cancellation - reconnectMu read locks are released when context times out Fixes: bd-p76kv Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Executed-By: beads/crew/dave Rig: beads Role: crew
This commit is contained in:
@@ -259,8 +259,13 @@ func (s *Server) handleRequest(req *Request) Response {
|
||||
}
|
||||
|
||||
// Adapter helpers
|
||||
|
||||
// reqCtx returns a context with the server's request timeout applied.
|
||||
// This prevents request handlers from hanging indefinitely if database
|
||||
// operations or other internal calls stall (GH#bd-p76kv).
|
||||
func (s *Server) reqCtx(_ *Request) context.Context {
|
||||
return context.Background()
|
||||
ctx, _ := context.WithTimeout(context.Background(), s.requestTimeout)
|
||||
return ctx
|
||||
}
|
||||
|
||||
func (s *Server) reqActor(req *Request) string {
|
||||
|
||||
Reference in New Issue
Block a user