@bobfrankston/iflow-direct 0.1.47 → 0.1.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/imap-native.js +19 -11
- package/package.json +1 -1
package/imap-native.js
CHANGED
|
@@ -467,19 +467,27 @@ export class NativeImapClient {
|
|
|
467
467
|
items.push("BODY.PEEK[]");
|
|
468
468
|
const tag = proto.nextTag();
|
|
469
469
|
const streamed = [];
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
470
|
+
// ALWAYS parse incrementally in the per-response callback — even
|
|
471
|
+
// when the caller passed no `onMessage`. The callback runs from
|
|
472
|
+
// processBuffer's 10 ms time-budgeted loop, so envelope parsing of a
|
|
473
|
+
// large FETCH (a sync-backfill chunk of 100+ messages) is sliced
|
|
474
|
+
// across event-loop turns. The old `onMessage ? stream : batch`
|
|
475
|
+
// path parsed every envelope in ONE synchronous block after the
|
|
476
|
+
// tagged OK — profiled 2026-05-15 as a ~30 s daemon wedge
|
|
477
|
+
// (tokenizeParenList ~40 % of CPU), starving every getMessage /
|
|
478
|
+
// move / delete IPC for the duration.
|
|
479
|
+
const cb = (resp) => {
|
|
480
|
+
if (resp.tag !== "*" || resp.type !== "FETCH")
|
|
481
|
+
return;
|
|
482
|
+
const parsed = this.parseFetchResponses([resp]);
|
|
483
|
+
for (const msg of parsed) {
|
|
484
|
+
streamed.push(msg);
|
|
485
|
+
if (onMessage)
|
|
477
486
|
onMessage(msg);
|
|
478
|
-
}
|
|
479
487
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
return
|
|
488
|
+
};
|
|
489
|
+
await this.sendCommand(tag, proto.fetchCommand(tag, range, items), cb);
|
|
490
|
+
return streamed;
|
|
483
491
|
}
|
|
484
492
|
/**
|
|
485
493
|
* Folder-scoped batch body fetch. Selects `folderPath`, issues a single
|