FFORGE//RS
← Roadmap

rust / LEVEL 4

The worker queue that never said no

EST.50 MIN
01

THEORY / RETRIEVAL

What to restore

  • Distinguish an unbounded channel from bounded admission
  • Return the rejected job when non-blocking admission finds a full queue
  • Close every sender before joining a receiver-driven worker
  • Translate worker panic into a typed shutdown error

A queue is part of the capacity contract

An unbounded channel turns overload into memory growth and stale work. A bounded channel makes the maximum waiting set explicit. Non-blocking admission can reject excess jobs immediately, while blocking send applies producer backpressure; the caller must choose that behavior deliberately.

Channel closure is ownership, not a control message

A receiver iterator ends only after every sender is dropped and the accepted queue is drained. Joining the worker while any sender clone remains live can wait forever. Consuming shutdown should close admission first, then join and return the processed evidence.

A thread panic is an error boundary

JoinHandle::join returns the panic payload instead of forcing the joining thread to panic. A service boundary can translate that outcome into a typed error, preserving a deterministic caller contract without pretending that partially completed external effects were rolled back.

CHECKPOINT

A single worker reads jobs through a channel. Which two review conclusions are required for bounded overload and finite graceful shutdown?

Select every applicable option. Credit requires an exact set match.

ISOLATED RUST 1.96
src/lib.rsEDIT

02 / DEBUGGING

Find and fix the defect

Repair BoundedWorker without changing its public API. Capacity zero must fail before spawning. try_submit must never block, must preserve the rejected job in Full or Closed, and must admit at most capacity waiting jobs. One worker processes accepted jobs exactly once in order. shutdown must drop the last sender before join, drain accepted jobs and translate panic into WorkerPanicked.

Initializing editor…
CLOUD SANDBOXnetwork off · 256 MB · 12 s
2 / 64 KB
OUTPUT
Runner is waiting for a submission.