@bobfrankston/mailx-imap 0.1.74 → 0.1.76

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.
Files changed (2) hide show
  1. package/index.js +17 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -594,7 +594,19 @@ export class ImapManager extends EventEmitter {
594
594
  if (!config)
595
595
  throw new Error(`No config for account ${accountId}`);
596
596
  const host = config.server || accountId;
597
- const releaseHostSlot = await this.acquireHostSlot(host);
597
+ // IDLE bypasses the host semaphore. The semaphore caps concurrent
598
+ // connection OPENS so a multi-account-on-one-host setup can't blow the
599
+ // server's connection limit — but IDLE is a SINGLE long-lived socket
600
+ // per account (the subscription), established once and parked. Gating
601
+ // it behind the same 4 permits that sync/prefetch/fast churn through
602
+ // meant that when sync saturated the pool (folders timing out at 360s),
603
+ // IDLE could not get a slot to (re)subscribe — so new mail stopped
604
+ // arriving by push and the user fell back to slow polling (Bob
605
+ // 2026-05-29: "you should be subscribed and not depend on sync"). The
606
+ // subscription must NEVER be starved by sync. One extra socket per
607
+ // account is well within any server cap.
608
+ const skipSemaphore = purpose === "idle";
609
+ const releaseHostSlot = skipSemaphore ? (() => { }) : await this.acquireHostSlot(host);
598
610
  let client;
599
611
  try {
600
612
  // Verbose IMAP wire trace for ops connections only — that's the
@@ -2762,7 +2774,7 @@ export class ImapManager extends EventEmitter {
2762
2774
  if (!raw)
2763
2775
  return null;
2764
2776
  const bodyPath = await this.bodyStore.putMessage(accountId, folderId, uid, raw);
2765
- this.db.updateBodyPath(accountId, uid, bodyPath);
2777
+ this.db.updateBodyPath(accountId, folderId, uid, bodyPath);
2766
2778
  this.emit("bodyCached", accountId, uid);
2767
2779
  return raw;
2768
2780
  }
@@ -2804,7 +2816,7 @@ export class ImapManager extends EventEmitter {
2804
2816
  }
2805
2817
  const raw = Buffer.from(msg.source, "utf-8");
2806
2818
  const bodyPath = await this.bodyStore.putMessage(accountId, folderId, uid, raw);
2807
- this.db.updateBodyPath(accountId, uid, bodyPath);
2819
+ this.db.updateBodyPath(accountId, folderId, uid, bodyPath);
2808
2820
  this.emit("bodyCached", accountId, uid);
2809
2821
  return raw;
2810
2822
  }
@@ -2985,7 +2997,7 @@ export class ImapManager extends EventEmitter {
2985
2997
  const raw = Buffer.from(source, "utf-8");
2986
2998
  const bodyPath = await this.bodyStore.putMessage(accountId, folderId, uid, raw);
2987
2999
  const parsed = await extractPreview(source);
2988
- this.db.updateBodyMeta(accountId, uid, bodyPath, parsed.hasAttachments, parsed.preview);
3000
+ this.db.updateBodyMeta(accountId, folderId, uid, bodyPath, parsed.hasAttachments, parsed.preview);
2989
3001
  this.emit("bodyCached", accountId, uid);
2990
3002
  counters.totalFetched++;
2991
3003
  madeProgress = true;
@@ -3117,7 +3129,7 @@ export class ImapManager extends EventEmitter {
3117
3129
  const raw = Buffer.from(source, "utf-8");
3118
3130
  const bodyPath = await this.bodyStore.putMessage(accountId, folderId, uid, raw);
3119
3131
  const parsed = await extractPreview(source);
3120
- this.db.updateBodyMeta(accountId, uid, bodyPath, parsed.hasAttachments, parsed.preview);
3132
+ this.db.updateBodyMeta(accountId, folderId, uid, bodyPath, parsed.hasAttachments, parsed.preview);
3121
3133
  this.emit("bodyCached", accountId, uid);
3122
3134
  this.clearPrefetchEmpty(accountId, folderId, uid); // healed — drop stale backoff
3123
3135
  counters.totalFetched++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.74",
3
+ "version": "0.1.76",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",