@bobfrankston/mailx-imap 0.1.80 → 0.1.81

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 (3) hide show
  1. package/index.d.ts +0 -1
  2. package/index.js +13 -6
  3. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -395,7 +395,6 @@ export declare class ImapManager extends EventEmitter {
395
395
  * no teal mark). With TTL, transient misses self-heal in 5 minutes;
396
396
  * genuine zombies back off to once-per-12-hour retries — bounded load.
397
397
  * Key shape `${accountId}:${folderId}:${uid}`. */
398
- private prefetchFailures;
399
398
  private markPrefetchEmpty;
400
399
  private isPrefetchEmpty;
401
400
  /** Clear a UID's prefetch-failure record after a successful fetch, so a
package/index.js CHANGED
@@ -2896,14 +2896,18 @@ export class ImapManager extends EventEmitter {
2896
2896
  * no teal mark). With TTL, transient misses self-heal in 5 minutes;
2897
2897
  * genuine zombies back off to once-per-12-hour retries — bounded load.
2898
2898
  * Key shape `${accountId}:${folderId}:${uid}`. */
2899
- prefetchFailures = new Map();
2899
+ // Backed by the persistent `prefetch_failures` table (was an in-memory
2900
+ // Map that every daemon restart wiped — so ghost UIDs re-clogged prefetch
2901
+ // on every launch; Bob 2026-06-01). markPrefetchEmpty/isPrefetchEmpty now
2902
+ // read/write the DB so the 5min→12h backoff survives restarts.
2900
2903
  markPrefetchEmpty(accountId, folderId, uid) {
2901
- const key = `${accountId}:${folderId}:${uid}`;
2902
- const prev = this.prefetchFailures.get(key);
2903
- this.prefetchFailures.set(key, { count: (prev?.count ?? 0) + 1, lastTried: Date.now() });
2904
+ try {
2905
+ this.db.recordPrefetchFailure(accountId, folderId, uid);
2906
+ }
2907
+ catch { /* non-fatal */ }
2904
2908
  }
2905
2909
  isPrefetchEmpty(accountId, folderId, uid) {
2906
- const f = this.prefetchFailures.get(`${accountId}:${folderId}:${uid}`);
2910
+ const f = this.db.getPrefetchFailure(accountId, folderId, uid);
2907
2911
  if (!f)
2908
2912
  return false;
2909
2913
  const backoffMs = f.count <= 1 ? 5 * 60_000
@@ -2919,7 +2923,10 @@ export class ImapManager extends EventEmitter {
2919
2923
  * count and would back off longer than warranted if it ever re-enters
2920
2924
  * the candidate set. */
2921
2925
  clearPrefetchEmpty(accountId, folderId, uid) {
2922
- this.prefetchFailures.delete(`${accountId}:${folderId}:${uid}`);
2926
+ try {
2927
+ this.db.clearPrefetchFailure(accountId, folderId, uid);
2928
+ }
2929
+ catch { /* non-fatal */ }
2923
2930
  }
2924
2931
  /** Background body-cache backfill. Public so the Reconciler can schedule
2925
2932
  * the periodic tick under its priority/back-pressure rules; existing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.80",
3
+ "version": "0.1.81",
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.42",
14
+ "@bobfrankston/mailx-store": "^0.1.43",
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.42",
42
+ "@bobfrankston/mailx-store": "^0.1.43",
43
43
  "@bobfrankston/iflow-direct": "^0.1.51",
44
44
  "@bobfrankston/tcp-transport": "^0.1.6",
45
45
  "@bobfrankston/smtp-direct": "^0.1.8",