Expand description
Wall-clock timeout, signal awareness, and cancel racing for one-shot runs.
§Workload classification (Rules Rust — parallelism)
- Class: signal/deadline coordination on the multi-thread one-shot runtime
(see
src/main.rsandcrate::concurrency). - Fan-out bound: fixed auxiliary tasks — at most one double-interrupt
watcher and one
ProgressGuardtimer per command (abort-on-drop). Product CPU/HTTP admission lives incrate::concurrency::ConcurrencyBudget. - Shared state:
CancelFlagand progressdoneuseArc<Atomic*>(SeqCst), neverMutexacross.await.
§Shutdown model (CLI one-shot)
Product policy is minimum + pipeline-critical shutdown, not daemon coordination:
detect (signals / deadline) → signal (CancelFlag) → await (race + flush) → DIE.
- Unix: SIGINT → interrupt (130); SIGTERM / SIGHUP → terminate (143)
- Windows: Ctrl+C → interrupt; Ctrl+Break / Ctrl+Close → terminate
- Second SIGINT / Ctrl+C within
DOUBLE_INTERRUPT_FORCE_SECSforce-exits 130 after flush - stdout
BrokenPipeis mapped by callers to exit 141 (Rust ignores SIGPIPE by default)
Structs§
- Cancel
Flag - Shared cancel flag checked by HTTP retries between attempts.
- Cancel
Poll - Helper future that polls cancel between retries (used by tests).
- Progress
Guard - Progress reporter: after
delay, emit one localized line to stderr if still running.
Enums§
- Cancel
Kind - Which OS signal cancelled the process.
Constants§
- DOUBLE_
INTERRUPT_ FORCE_ SECS - Window for second SIGINT to force-exit (Rules Rust: double Ctrl-C).
Functions§
- duration_
ms - Elapsed milliseconds since start.
- flush_
stdio - Flush stdout and stderr best-effort (FINALIZE).
- race_
op_ with_ cancel_ and_ deadline - Race an operation against cancel signals and an optional wall-clock deadline.
- spawn_
double_ interrupt_ force_ exit - Install a process-wide second-SIGINT force-exit watcher.
- wait_
for_ cancel - Future that completes when a cancel signal arrives.
- with_
wall_ clock - Run a future with a wall-clock deadline.