@bobfrankston/mailx-imap 0.1.73 → 0.1.74

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 +20 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2467,14 +2467,29 @@ export class ImapManager extends EventEmitter {
2467
2467
  // Quick STATUS check (above) and actions/outbox drain (above)
2468
2468
  // stay here because they're tightly tied to IMAP connection state
2469
2469
  // and the `syncing` flag.
2470
- // Full sync (all folders + IDLE restart) at configured interval.
2471
- // Stays here because callers pass `intervalMinutes` directly —
2472
- // moving it would mean threading the value through MailxService
2473
- // Reconciler with a separate setter, for no behavior gain.
2470
+ // LAZY FOLDER SYNC (Thunderbird model Bob 2026-05-28). The full
2471
+ // sweep of ALL folders no longer runs on the tight `intervalMinutes`
2472
+ // (5 min) timer. On a mailbox with 79 folders + a 135k INBOX, that
2473
+ // sweep ran longer than 5 minutes (folders timing out at 360s) and
2474
+ // was therefore ALWAYS running, saturating the 4-permit connection
2475
+ // semaphore. That starved the three things that actually matter —
2476
+ // new INBOX mail (IDLE re-establish), body prefetch, and click-to-read
2477
+ // — producing the session's running complaints: "slow to get codes",
2478
+ // "lots not prefetched", "Loading… forever".
2479
+ //
2480
+ // New model:
2481
+ // - INBOX: IDLE push (instant) + the 5-min quick STATUS check above
2482
+ // (safety net). Unchanged — INBOX stays fresh.
2483
+ // - Every other folder: synced ON OPEN (the client fires syncFolder
2484
+ // when the user selects a folder) + a slow background sweep at
2485
+ // FULL_SWEEP_MIN so nothing goes stale indefinitely.
2486
+ // The slow sweep keeps connection headroom free for the hot paths.
2487
+ const FULL_SWEEP_MIN = 30;
2474
2488
  const fullInterval = setInterval(() => {
2475
2489
  this.runFullSync().catch(e => console.error(` [periodic] full sync error: ${e?.message || e}`));
2476
- }, intervalMinutes * 60000);
2490
+ }, FULL_SWEEP_MIN * 60000);
2477
2491
  this.syncIntervals.set("all", fullInterval);
2492
+ console.log(` [periodic] full all-folders sweep every ${FULL_SWEEP_MIN}min (lazy model — folders also sync on open); INBOX stays live via IDLE + ${intervalMinutes}min quick check`);
2478
2493
  }
2479
2494
  /** One-shot full sync + IDLE restart. Public so callers (Reconciler,
2480
2495
  * user-initiated "Sync now") can fire it on demand. The original body
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.73",
3
+ "version": "0.1.74",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",