@bobfrankston/mailx-imap 0.1.88 → 0.1.90

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 +23 -1
  2. package/package.json +5 -5
package/index.js CHANGED
@@ -2829,6 +2829,15 @@ export class ImapManager extends EventEmitter {
2829
2829
  }
2830
2830
  if (!this.configs.has(accountId))
2831
2831
  return null;
2832
+ // Back off a body that recently hung / failed. One un-fetchable message
2833
+ // (the server stalls on its BODY[] — Bob 2026-06-12, UID 4966060) was
2834
+ // being re-fetched on every view + prefetch tick, each attempt hanging
2835
+ // ~90s and tying up the ops queue, so user actions (delete, open) were
2836
+ // delayed until the client timed out. The 5min→12h backoff (shared with
2837
+ // prefetch via isPrefetchEmpty) stops the tight re-fetch loop; the body
2838
+ // simply shows as unavailable until the backoff lapses and one retry runs.
2839
+ if (this.isPrefetchEmpty(accountId, folderId, uid))
2840
+ return null;
2832
2841
  const folder = this.db.getFolders(accountId).find(f => f.id === folderId);
2833
2842
  if (!folder)
2834
2843
  return null;
@@ -2859,6 +2868,12 @@ export class ImapManager extends EventEmitter {
2859
2868
  if (e?.isNotFound)
2860
2869
  throw e;
2861
2870
  console.error(` Body fetch error (${accountId}/${uid}): ${e?.message || e}`);
2871
+ // Record so the next view / prefetch backs off instead of
2872
+ // re-attempting a hanging fetch and re-congesting the queue.
2873
+ try {
2874
+ this.markPrefetchEmpty(accountId, folderId, uid);
2875
+ }
2876
+ catch { /* */ }
2862
2877
  return null;
2863
2878
  }
2864
2879
  }
@@ -3432,7 +3447,14 @@ export class ImapManager extends EventEmitter {
3432
3447
  }
3433
3448
  try {
3434
3449
  if (action.action === "flags" && api.setFlags) {
3435
- await api.setFlags(folder.path, action.uid, action.flags || []);
3450
+ // Pass the stored Gmail message id (provider_id) for
3451
+ // the same reason as trashMessage below: without it
3452
+ // setFlags falls back to a capped list-and-hash
3453
+ // search that misses older messages, so starring one
3454
+ // failed ("UID not found in INBOX") and the local
3455
+ // star reverted on the next sync (Bob 2026-06-12).
3456
+ const env = this.db.getMessageByUid(accountId, action.uid);
3457
+ await api.setFlags(folder.path, action.uid, action.flags || [], env?.providerId);
3436
3458
  console.log(` [api] ${accountId}: flags synced UID ${action.uid}`);
3437
3459
  }
3438
3460
  else if ((action.action === "delete" || action.action === "trash") && api.trashMessage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.88",
3
+ "version": "0.1.90",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -11,11 +11,11 @@
11
11
  "dependencies": {
12
12
  "@bobfrankston/mailx-types": "^0.1.19",
13
13
  "@bobfrankston/mailx-settings": "^0.1.26",
14
- "@bobfrankston/mailx-store": "^0.1.46",
14
+ "@bobfrankston/mailx-store": "^0.1.47",
15
15
  "@bobfrankston/iflow-direct": "^0.1.53",
16
16
  "@bobfrankston/tcp-transport": "^0.1.7",
17
17
  "@bobfrankston/smtp-direct": "^0.1.9",
18
- "@bobfrankston/mailx-sync": "^0.1.20",
18
+ "@bobfrankston/mailx-sync": "^0.1.22",
19
19
  "@bobfrankston/oauthsupport": "^1.0.32"
20
20
  },
21
21
  "repository": {
@@ -39,11 +39,11 @@
39
39
  "dependencies": {
40
40
  "@bobfrankston/mailx-types": "^0.1.19",
41
41
  "@bobfrankston/mailx-settings": "^0.1.26",
42
- "@bobfrankston/mailx-store": "^0.1.46",
42
+ "@bobfrankston/mailx-store": "^0.1.47",
43
43
  "@bobfrankston/iflow-direct": "^0.1.53",
44
44
  "@bobfrankston/tcp-transport": "^0.1.7",
45
45
  "@bobfrankston/smtp-direct": "^0.1.9",
46
- "@bobfrankston/mailx-sync": "^0.1.20",
46
+ "@bobfrankston/mailx-sync": "^0.1.22",
47
47
  "@bobfrankston/oauthsupport": "^1.0.32"
48
48
  }
49
49
  }