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

Method enqueue

packages/runtime/src/async-queue.ts:72–82  ·  view source on GitHub ↗
(item: T)

Source from the content-addressed store, hash-verified

70 }
71
72 private enqueue(item: T): number {
73 const sequence = ++this.pushedCount;
74 const w = this.waiters.shift();
75 if (w) {
76 w.resolve({ value: item, done: false });
77 } else {
78 this.buf.push(item);
79 }
80 this.wake();
81 return sequence;
82 }
83
84 private async waitUntilConsumed(sequence: number): Promise<void> {
85 while (this.consumedCount < sequence) {

Callers 15

pushMethod · 0.95
startFunction · 0.45
transformFunction · 0.45
flushFunction · 0.45
trackStreamMethod · 0.45
transformFunction · 0.45
flushFunction · 0.45
finishFunction · 0.45
onMessageFunction · 0.45
transformFunction · 0.45
flushFunction · 0.45

Calls 3

wakeMethod · 0.95
resolveMethod · 0.65
pushMethod · 0.65

Tested by 9

startFunction · 0.36
startFunction · 0.36
pullFunction · 0.36
startFunction · 0.36
startFunction · 0.36
startFunction · 0.36
startFunction · 0.36
pullFunction · 0.36
pullFunction · 0.36