MCPcopy Create free account
hub / github.com/apache/maka / pushAndWaitUntilConsumed

Method pushAndWaitUntilConsumed

packages/runtime/src/async-queue.ts:52–58  ·  view source on GitHub ↗

* Enqueue one item and resolve only after the consumer has fully processed * that exact sequence. Unlike `push()`, an enqueue rejected by queue state is * observable by the producer.

(item: T)

Source from the content-addressed store, hash-verified

50 * observable by the producer.
51 */
52 pushAndWaitUntilConsumed(item: T): Promise<void> {
53 if (this.err) return Promise.reject(this.err);
54 if (this.consumerDetached) return Promise.reject(consumerDetachedError());
55 if (this.closed) return Promise.reject(queueClosedError());
56 const sequence = this.enqueue(item);
57 return this.waitUntilConsumed(sequence);
58 }
59
60 /**
61 * Wait through the producer boundary captured at call time. Items enqueued

Callers

nothing calls this directly

Calls 5

enqueueMethod · 0.95
waitUntilConsumedMethod · 0.95
consumerDetachedErrorFunction · 0.85
queueClosedErrorFunction · 0.85
rejectMethod · 0.65

Tested by

no test coverage detected