@bobfrankston/mailx-imap 0.1.81 → 0.1.82

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 +16 -5
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -1864,8 +1864,19 @@ export class ImapManager extends EventEmitter {
1864
1864
  // a "never-touched" non-special folder is deferred until the
1865
1865
  // user opens that folder (on-demand syncFolder call) or until
1866
1866
  // ~3 minutes after startup when the event loop is quiet.
1867
- const STARTUP_LAZY_DELAY_MS = 3 * 60 * 1000;
1868
- const startupQuietPoint = (this._startupAt || 0) + STARTUP_LAZY_DELAY_MS;
1867
+ // TRUE lazy folder sync (C119, completed 2026-06-01). A folder is
1868
+ // "lazy" if it's neither a priority special-use folder NOR one
1869
+ // mailx has ever pulled a message from (highestUid===0). Lazy
1870
+ // folders are NOT auto-synced at all — they sync on-demand the
1871
+ // moment the user opens them (the client fires `syncFolderNow` on
1872
+ // folder-open) and then join the periodic set automatically once
1873
+ // they have a message (highestUid>0). Previously they were only
1874
+ // deferred for a 3-minute startup window, after which a full
1875
+ // 96-folder sweep ran every cycle — re-saturating the IMAP
1876
+ // connection and pegging the event loop (the "mailx DOSes itself,
1877
+ // TB doesn't" storm, Bob 2026-06-01). Permanent deferral closes it:
1878
+ // a fresh rebuild now syncs only INBOX + special-use, and the rest
1879
+ // fill in as the user actually visits them.
1869
1880
  const isLazyEligible = (f) => {
1870
1881
  if (f.specialUse && priorityOrder.includes(f.specialUse))
1871
1882
  return false;
@@ -1873,15 +1884,15 @@ export class ImapManager extends EventEmitter {
1873
1884
  return false;
1874
1885
  return true;
1875
1886
  };
1876
- const remaining = folders.filter(f => f.specialUse !== "inbox" && !(isLazyEligible(f) && Date.now() < startupQuietPoint));
1887
+ const remaining = folders.filter(f => f.specialUse !== "inbox" && !isLazyEligible(f));
1877
1888
  remaining.sort((a, b) => {
1878
1889
  const pa = priorityOrder.indexOf(a.specialUse || "") >= 0 ? priorityOrder.indexOf(a.specialUse || "") : 5;
1879
1890
  const pb = priorityOrder.indexOf(b.specialUse || "") >= 0 ? priorityOrder.indexOf(b.specialUse || "") : 5;
1880
1891
  return pa - pb;
1881
1892
  });
1882
- const deferredCount = folders.filter(f => f.specialUse !== "inbox" && isLazyEligible(f) && Date.now() < startupQuietPoint).length;
1893
+ const deferredCount = folders.filter(f => f.specialUse !== "inbox" && isLazyEligible(f)).length;
1883
1894
  if (deferredCount > 0) {
1884
- console.log(` [sync] ${accountId}: deferring first-sync of ${deferredCount} non-priority folder(s) until ${new Date(startupQuietPoint).toLocaleTimeString()} or user opens them`);
1895
+ console.log(` [sync] ${accountId}: lazy ${deferredCount} never-touched folder(s) will sync on-demand when opened (not auto-swept)`);
1885
1896
  }
1886
1897
  const CONCURRENCY = 2;
1887
1898
  // First-sync of a fresh account on a cold Dovecot is dominated by
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.81",
3
+ "version": "0.1.82",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@bobfrankston/mailx-types": "^0.1.18",
13
13
  "@bobfrankston/mailx-settings": "^0.1.26",
14
- "@bobfrankston/mailx-store": "^0.1.43",
14
+ "@bobfrankston/mailx-store": "^0.1.44",
15
15
  "@bobfrankston/iflow-direct": "^0.1.51",
16
16
  "@bobfrankston/tcp-transport": "^0.1.6",
17
17
  "@bobfrankston/smtp-direct": "^0.1.8",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@bobfrankston/mailx-types": "^0.1.18",
41
41
  "@bobfrankston/mailx-settings": "^0.1.26",
42
- "@bobfrankston/mailx-store": "^0.1.43",
42
+ "@bobfrankston/mailx-store": "^0.1.44",
43
43
  "@bobfrankston/iflow-direct": "^0.1.51",
44
44
  "@bobfrankston/tcp-transport": "^0.1.6",
45
45
  "@bobfrankston/smtp-direct": "^0.1.8",