@bobfrankston/rmfmail 1.1.208 → 1.1.209
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.
- package/client/app.bundle.js +2 -1
- package/client/app.bundle.js.map +2 -2
- package/client/app.js +6 -1
- package/client/app.js.map +1 -1
- package/client/app.ts +6 -1
- package/client/index.html +1 -0
- package/package.json +3 -3
- package/packages/mailx-imap/index.d.ts +0 -1
- package/packages/mailx-imap/index.d.ts.map +1 -1
- package/packages/mailx-imap/index.js +13 -6
- package/packages/mailx-imap/index.js.map +1 -1
- package/packages/mailx-imap/index.ts +7 -6
- package/packages/mailx-imap/package-lock.json +2 -2
- package/packages/mailx-imap/package.json +1 -1
- package/packages/mailx-store/db.d.ts +10 -0
- package/packages/mailx-store/db.d.ts.map +1 -1
- package/packages/mailx-store/db.js +34 -0
- package/packages/mailx-store/db.js.map +1 -1
- package/packages/mailx-store/db.ts +41 -0
- package/packages/mailx-store/package.json +1 -1
- /package/packages/mailx-imap/{node_modules.npmglobalize-stash-33420 → node_modules.npmglobalize-stash-69236}/.package-lock.json +0 -0
|
@@ -302,6 +302,23 @@ const SCHEMA = `
|
|
|
302
302
|
PRIMARY KEY(scope, key)
|
|
303
303
|
);
|
|
304
304
|
|
|
305
|
+
-- Prefetch-failure backoff, PERSISTED (was an in-memory Map that every
|
|
306
|
+
-- daemon restart wiped — so un-fetchable "ghost" UIDs, e.g. stale Outbox
|
|
307
|
+
-- rows for already-sent messages that return 0 bodies, got re-tried in
|
|
308
|
+
-- full on every launch and re-clogged the size-asc prefetch queue,
|
|
309
|
+
-- starving healthy folders. "So much unfetched, never drains" — Bob
|
|
310
|
+
-- 2026-06-01. Persisting the count+timestamp lets the 5min→12h backoff
|
|
311
|
+
-- survive restarts so zombies stay sidelined. Pure cache-control state;
|
|
312
|
+
-- safe to lose (worst case = one extra retry), so no reconstruction needed.
|
|
313
|
+
CREATE TABLE IF NOT EXISTS prefetch_failures (
|
|
314
|
+
account_id TEXT NOT NULL,
|
|
315
|
+
folder_id INTEGER NOT NULL,
|
|
316
|
+
uid INTEGER NOT NULL,
|
|
317
|
+
count INTEGER NOT NULL,
|
|
318
|
+
last_tried INTEGER NOT NULL,
|
|
319
|
+
PRIMARY KEY(account_id, folder_id, uid)
|
|
320
|
+
);
|
|
321
|
+
|
|
305
322
|
-- Audit trail of every destructive DB operation. Writes ONLY — the row
|
|
306
323
|
-- inserted here records the deletion the caller is about to (or just
|
|
307
324
|
-- did) commit on the messages table. Lets the user retroactively answer
|
|
@@ -2243,6 +2260,30 @@ export class MailxDB {
|
|
|
2243
2260
|
).all(accountId, ...excludeFolderIds, limit) as any[];
|
|
2244
2261
|
}
|
|
2245
2262
|
|
|
2263
|
+
/** Record a prefetch failure (0-body fetch / store-write fail) for a UID,
|
|
2264
|
+
* incrementing its backoff count. Persisted so it survives restarts. */
|
|
2265
|
+
recordPrefetchFailure(accountId: string, folderId: number, uid: number): void {
|
|
2266
|
+
this.db.prepare(
|
|
2267
|
+
`INSERT INTO prefetch_failures (account_id, folder_id, uid, count, last_tried)
|
|
2268
|
+
VALUES (?, ?, ?, 1, ?)
|
|
2269
|
+
ON CONFLICT(account_id, folder_id, uid)
|
|
2270
|
+
DO UPDATE SET count = count + 1, last_tried = excluded.last_tried`
|
|
2271
|
+
).run(accountId, folderId, uid, Date.now());
|
|
2272
|
+
}
|
|
2273
|
+
/** Read a UID's prefetch-failure record (count + lastTried), or null. */
|
|
2274
|
+
getPrefetchFailure(accountId: string, folderId: number, uid: number): { count: number; lastTried: number } | null {
|
|
2275
|
+
const r = this.db.prepare(
|
|
2276
|
+
"SELECT count, last_tried AS lastTried FROM prefetch_failures WHERE account_id = ? AND folder_id = ? AND uid = ?"
|
|
2277
|
+
).get(accountId, folderId, uid) as any;
|
|
2278
|
+
return r ? { count: r.count, lastTried: r.lastTried } : null;
|
|
2279
|
+
}
|
|
2280
|
+
/** Clear a UID's prefetch-failure record after a successful fetch. */
|
|
2281
|
+
clearPrefetchFailure(accountId: string, folderId: number, uid: number): void {
|
|
2282
|
+
this.db.prepare(
|
|
2283
|
+
"DELETE FROM prefetch_failures WHERE account_id = ? AND folder_id = ? AND uid = ?"
|
|
2284
|
+
).run(accountId, folderId, uid);
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2246
2287
|
/** Highest server UID we've seen in this folder. After the
|
|
2247
2288
|
* message_folders refactor, this reads from the membership table
|
|
2248
2289
|
* rather than messages.uid — a server-side move from this folder
|