You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a decdn node drain --wait flag that blocks until all in-flight streams complete before the node exits #604
The existing drain subcommand signals the node to stop accepting new connections, but there is no mechanism for operators to wait synchronously until all active client streams finish before restarting or upgrading the node binary. A --wait flag with a configurable timeout would make zero-payment-loss rolling upgrades straightforward in operator runbooks.
This is a well-scoped operator UX feature request: add a --wait [timeout] flag to decdn node drain that blocks the CLI until all in-flight client streams have fully drained before returning, enabling zero-payment-loss rolling upgrades. The motivation (avoiding mid-stream payment channel disruption) maps clearly to the dual-currency model and the cdn/client/v1 paid delivery protocol. The request is sufficiently detailed to act on directly.
📊 Assessment
Dimension
Value
Reasoning
Type
Feature
New behaviour on an existing subcommand; no existing type set
Labels
enhancement, technical, cli (already applied)
Accurate; no additional labels needed
Coding agent
Suitable
Requirements are clear: add --wait flag with configurable timeout to the drain subcommand, poll or await a "no active streams" condition from the node admin RPC, exit 0 on clean drain and non-zero on timeout
💡 Notes and suggestions
Implementation sketch
Admin RPC surface (crates/common/src/admin_rpc.rs or similar) — add a DrainStatus query that returns the current count of active connections/streams from the ConnectionLimiter. The drain subcommand already tells the node to stop accepting; the new endpoint just reports when the counter hits zero.
CLI flag (crates/cli) — add --wait (bool) and --timeout <secs> (default e.g. 300 s) to the drain subcommand. When --wait is set, poll DrainStatus in a loop (e.g. every 250 ms) until count == 0 or timeout elapses.
Exit codes — exit 0 on clean drain, non-zero (e.g. 1) on timeout so operators can gate deployments in shell scripts.
Progress output — optionally print remaining stream count to stderr on each poll so operators see progress without needing --verbose.
Relevant code locations to read first
crates/node/src/runtime/mod.rs — where the ConnectionLimiter and router live
crates/common/src/admin_rpc.rs (or wherever AdminRpc trait is declared) — the RPC trait that the CLI calls
Activity
github-actions commentedon May 19, 2026
🎯 Triage report
This is a well-scoped operator UX feature request: add a
--wait [timeout]flag todecdn node drainthat blocks the CLI until all in-flight client streams have fully drained before returning, enabling zero-payment-loss rolling upgrades. The motivation (avoiding mid-stream payment channel disruption) maps clearly to the dual-currency model and thecdn/client/v1paid delivery protocol. The request is sufficiently detailed to act on directly.📊 Assessment
enhancement,technical,cli(already applied)--waitflag with configurable timeout to the drain subcommand, poll or await a "no active streams" condition from the node admin RPC, exit 0 on clean drain and non-zero on timeout💡 Notes and suggestions
Implementation sketch
Admin RPC surface (
crates/common/src/admin_rpc.rsor similar) — add aDrainStatusquery that returns the current count of active connections/streams from theConnectionLimiter. The drain subcommand already tells the node to stop accepting; the new endpoint just reports when the counter hits zero.CLI flag (
crates/cli) — add--wait(bool) and--timeout <secs>(default e.g. 300 s) to thedrainsubcommand. When--waitis set, pollDrainStatusin a loop (e.g. every 250 ms) until count == 0 or timeout elapses.Exit codes — exit 0 on clean drain, non-zero (e.g. 1) on timeout so operators can gate deployments in shell scripts.
Progress output — optionally print remaining stream count to stderr on each poll so operators see progress without needing
--verbose.Relevant code locations to read first
crates/node/src/runtime/mod.rs— where theConnectionLimiterand router livecrates/common/src/admin_rpc.rs(or whereverAdminRpctrait is declared) — the RPC trait that the CLI callscrates/cli/src/— existingdrainsubcommand implementationSuccess criteria
decdn node drain --waitreturns only after all active streams completedecdn node drain --wait --timeout 60returns exit 1 and prints a message if 60 s elapses with streams still activedecdn node drain(no flag) behaviour is unchangedreview: wrap drain param in Option + ack `wait_admin_honored` (#604)
review: address comprehensive review findings (#604)
feat(cli): add `decdn node drain --wait` for zero-payment-loss upgrad…
Merge branch 'main' into dht-record-store