MCPcopy
hub / github.com/pingdotgg/t3code / DrainableWorker

Interface DrainableWorker

packages/shared/src/DrainableWorker.ts:16–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14import * as TxRef from "effect/TxRef";
15
16export interface DrainableWorker<A> {
17 /**
18 * Enqueue a work item and track it for `drain()`.
19 *
20 * This wraps `Queue.offer` so drain state is updated atomically with the
21 * enqueue path instead of inferring it from queue internals.
22 */
23 readonly enqueue: (item: A) => Effect.Effect<void>;
24
25 /**
26 * Resolves when the queue is empty and the worker is idle (not processing).
27 */
28 readonly drain: Effect.Effect<void>;
29}
30
31/**
32 * Create a drainable worker that processes items from an unbounded queue.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected