MCPcopy Index your code
hub / github.com/nodejs/node / #resolvePendingReads

Method #resolvePendingReads

lib/internal/streams/iter/push.js:467–491  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

465 }
466
467 #resolvePendingReads() {
468 while (this.#pendingReads.length > 0) {
469 if (this.#slots.length > 0) {
470 const pending = this.#pendingReads.shift();
471 const result = this.#drain();
472 this.#resolvePendingWrites();
473 pending.resolve({ __proto__: null, done: false, value: result });
474 } else if (this.#writerState === 'closing' && this.#slots.length === 0) {
475 this.endDrained();
476 const pending = this.#pendingReads.shift();
477 pending.resolve({ __proto__: null, done: true, value: undefined });
478 } else if (this.#writerState === 'closed') {
479 const pending = this.#pendingReads.shift();
480 pending.resolve({ __proto__: null, done: true, value: undefined });
481 } else if (this.#writerState === 'errored') {
482 const pending = this.#pendingReads.shift();
483 pending.reject(this.#error);
484 } else if (this.#consumerState === 'returned') {
485 const pending = this.#pendingReads.shift();
486 pending.resolve({ __proto__: null, done: true, value: undefined });
487 } else {
488 break;
489 }
490 }
491 }
492
493 #resolvePendingWrites() {
494 while (this.#pendingWrites.length > 0 &&

Callers 3

writeSyncMethod · 0.95
endMethod · 0.95
consumerReturnMethod · 0.95

Calls 6

#drainMethod · 0.95
#resolvePendingWritesMethod · 0.95
endDrainedMethod · 0.95
rejectMethod · 0.80
shiftMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected