Documentation
¶
Overview ¶
Package shutdown is what a shutdown does with the work still in flight (#2058): the drains components register to stop taking new work and finish what they hold, run in the background from the signal beside the HTTP drain, and the close of live MCP sessions that sends connected agents to the new build while leaving the in-process sessions to the work they carry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseSessions ¶
CloseSessions closes every live MCP session so connected clients drop their stale connection and reconnect to the new build (#675). Claude Code auto-reconnects HTTP/SSE servers and re-handshakes (fresh tools/list); Claude Desktop requires an app restart.
ServerSession.Close is graceful: an idle session's long-lived SSE/streamable stream drops immediately, but a session with an in-flight tool call blocks until that call returns, and that wait is not bounded by the HTTP grace period. So the closes run in a goroutine bounded by ctx (the shutdown deadline): if they do not all finish in time, we return and let process exit drop the remaining connections rather than hang past terminationGracePeriodSeconds and risk a SIGKILL mid-call.
Types ¶
type Drains ¶
type Drains struct {
// contains filtered or unexported fields
}
Drains is the set of drains a lifecycle runs before it stops its components: each stops taking new work and finishes what it holds, bounded by the context it is given. A managed-script run claimed seconds before a SIGTERM finishes in its drain instead of being cut off; what a drain does not finish is the component's stop to release. The zero value is ready.