@bobfrankston/mailx 1.0.240 → 1.0.242

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.
@@ -1 +1 @@
1
- {"height":1344,"width":2151,"x":656,"y":239}
1
+ {"height":1344,"width":2151,"x":524,"y":191}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx",
3
- "version": "1.0.240",
3
+ "version": "1.0.242",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",
@@ -24,7 +24,7 @@
24
24
  "@bobfrankston/iflow-node": "^0.1.2",
25
25
  "@bobfrankston/miscinfo": "^1.0.8",
26
26
  "@bobfrankston/oauthsupport": "^1.0.22",
27
- "@bobfrankston/msger": "^0.1.302",
27
+ "@bobfrankston/msger": "^0.1.304",
28
28
  "@capacitor/android": "^8.3.0",
29
29
  "@capacitor/cli": "^8.3.0",
30
30
  "@capacitor/core": "^8.3.0",
@@ -78,7 +78,7 @@
78
78
  "@bobfrankston/iflow-node": "^0.1.2",
79
79
  "@bobfrankston/miscinfo": "^1.0.8",
80
80
  "@bobfrankston/oauthsupport": "^1.0.22",
81
- "@bobfrankston/msger": "^0.1.302",
81
+ "@bobfrankston/msger": "^0.1.304",
82
82
  "@capacitor/android": "^8.3.0",
83
83
  "@capacitor/cli": "^8.3.0",
84
84
  "@capacitor/core": "^8.3.0",
@@ -788,15 +788,21 @@ export class ImapManager extends EventEmitter {
788
788
  }
789
789
  async _syncAll() {
790
790
  const priorityOrder = ["sent", "drafts", "archive", "junk", "trash"];
791
- // Sync all accounts in parallel — each manages its own connection
792
- const syncPromises = [...this.configs.keys()].map(accountId => this.syncAccount(accountId, priorityOrder));
793
- await Promise.allSettled(syncPromises);
794
- // Background body prefetch after sync, fetch bodies for messages that don't have them
795
- if (getPrefetch()) {
796
- for (const accountId of this.configs.keys()) {
791
+ // Sync all accounts in parallel — each manages its own connection.
792
+ // Prefetch runs per-account immediately after that account's sync
793
+ // completes, NOT after all accounts finish. This way a slow account
794
+ // (bobma with 300s timeouts) doesn't block prefetch for a fast account
795
+ // (Gmail). The old code put prefetch after `allSettled`, but syncAll
796
+ // has a 10-minute wall-clock timeout that killed it first — so
797
+ // prefetch never ran.
798
+ const syncAndPrefetch = async (accountId) => {
799
+ await this.syncAccount(accountId, priorityOrder);
800
+ if (getPrefetch()) {
797
801
  this.prefetchBodies(accountId).catch(e => console.error(` [prefetch] ${accountId}: ${e.message}`));
798
802
  }
799
- }
803
+ };
804
+ const syncPromises = [...this.configs.keys()].map(syncAndPrefetch);
805
+ await Promise.allSettled(syncPromises);
800
806
  }
801
807
  /** Sync a single account — manages its own connection lifecycle */
802
808
  async syncAccount(accountId, priorityOrder) {
@@ -1236,7 +1242,11 @@ export class ImapManager extends EventEmitter {
1236
1242
  // which gives instant push — the STATUS poll is just a fallback
1237
1243
  // in case IDLE silently dropped.
1238
1244
  const isGmail = this.isGmailAccount(accountId);
1239
- const interval = isGmail ? 15000 : 300000; // Gmail API: 15s; IMAP with IDLE: 5min
1245
+ // Both Gmail API and IMAP accounts have IDLE running for instant
1246
+ // push. The STATUS poll is just a safety net for silent IDLE drops.
1247
+ // Keep it infrequent to avoid hammering — Gmail 429 rate limits
1248
+ // and Dovecot connection limits are both real constraints.
1249
+ const interval = isGmail ? 120000 : 300000; // Gmail: 2min; IMAP: 5min
1240
1250
  const timer = setInterval(() => {
1241
1251
  this.quickInboxCheckAccount(accountId).catch(() => { });
1242
1252
  }, interval);