Skip to main content

drain

Function drain 

Source
pub async fn drain(args: &DrainArgs, global_config: Option<&Path>) -> Result<()>
Expand description

decdn node drain: call admin_v1_drain on the running node to trigger graceful shutdown (issue #244, appendix-local-admin-http.md).

Without --wait: fire-and-forget — returns drain_initiated=true as soon as the trigger is queued; observe completion via process exit or decdn node health until ECONNREFUSED.

With --wait (issue #604): asks the runtime to keep the admin server alive through router.shutdown (DrainRequest { wait_admin: true }), then polls admin_v1_health for in_flight_streams == 0. Returns Ok once the count reaches 0 or admin closes (ECONNREFUSED — drain finished and tore admin down). Returns Err with drain_timeout=true in_flight_streams=N on stderr if --wait-timeout-secs elapses first.