Skip to content

Add a decdn node drain --wait flag that blocks until all in-flight streams complete before the node exits #604

Closed

Description

@alpergundogdu

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.


Filed via GitDailyReporterBot

Activity

  1. added
    kind:feature
    area:cli
    on May 19, 2026
  2. github-actions commented on May 19, 2026

    @github-actions

    🎯 Triage report

    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

    1. 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.

    2. 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.

    3. Exit codes — exit 0 on clean drain, non-zero (e.g. 1) on timeout so operators can gate deployments in shell scripts.

    4. 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
    • crates/cli/src/ — existing drain subcommand implementation

    Success criteria

    • decdn node drain --wait returns only after all active streams complete
    • decdn node drain --wait --timeout 60 returns exit 1 and prints a message if 60 s elapses with streams still active
    • Existing decdn node drain (no flag) behaviour is unchanged

    Generated by Agentic Triage for issue #604 · ● 1.1M · ◷

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. self-assigned this
    on May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:clikind:feature

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions