MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / pullWithDefaultReader

Function pullWithDefaultReader

out/cli.cjs:13583–13643  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13581 });
13582 }
13583 function pullWithDefaultReader() {
13584 if (IsReadableStreamBYOBReader(reader)) {
13585 ReadableStreamReaderGenericRelease(reader);
13586 reader = AcquireReadableStreamDefaultReader(stream4);
13587 forwardReaderError(reader);
13588 }
13589 const readRequest = {
13590 _chunkSteps: (chunk) => {
13591 _queueMicrotask(() => {
13592 readAgainForBranch1 = false;
13593 readAgainForBranch2 = false;
13594 const chunk1 = chunk;
13595 let chunk2 = chunk;
13596 if (!canceled1 && !canceled2) {
13597 try {
13598 chunk2 = CloneAsUint8Array(chunk);
13599 } catch (cloneE) {
13600 ReadableByteStreamControllerError(branch1._readableStreamController, cloneE);
13601 ReadableByteStreamControllerError(branch2._readableStreamController, cloneE);
13602 resolveCancelPromise(ReadableStreamCancel(stream4, cloneE));
13603 return;
13604 }
13605 }
13606 if (!canceled1) {
13607 ReadableByteStreamControllerEnqueue(branch1._readableStreamController, chunk1);
13608 }
13609 if (!canceled2) {
13610 ReadableByteStreamControllerEnqueue(branch2._readableStreamController, chunk2);
13611 }
13612 reading = false;
13613 if (readAgainForBranch1) {
13614 pull1Algorithm();
13615 } else if (readAgainForBranch2) {
13616 pull2Algorithm();
13617 }
13618 });
13619 },
13620 _closeSteps: () => {
13621 reading = false;
13622 if (!canceled1) {
13623 ReadableByteStreamControllerClose(branch1._readableStreamController);
13624 }
13625 if (!canceled2) {
13626 ReadableByteStreamControllerClose(branch2._readableStreamController);
13627 }
13628 if (branch1._readableStreamController._pendingPullIntos.length > 0) {
13629 ReadableByteStreamControllerRespond(branch1._readableStreamController, 0);
13630 }
13631 if (branch2._readableStreamController._pendingPullIntos.length > 0) {
13632 ReadableByteStreamControllerRespond(branch2._readableStreamController, 0);
13633 }
13634 if (!canceled1 || !canceled2) {
13635 resolveCancelPromise(void 0);
13636 }
13637 },
13638 _errorSteps: () => {
13639 reading = false;
13640 }

Callers 2

pull1AlgorithmFunction · 0.85
pull2AlgorithmFunction · 0.85

Calls 14

forwardReaderErrorFunction · 0.85
_queueMicrotaskFunction · 0.85
CloneAsUint8ArrayFunction · 0.85
ReadableStreamCancelFunction · 0.85
pull1AlgorithmFunction · 0.85
pull2AlgorithmFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…