@bobfrankston/mailx-imap 0.1.116 → 0.1.117
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/index.js +11 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2216,10 +2216,17 @@ export class ImapManager extends EventEmitter {
|
|
|
2216
2216
|
// to dest), the (acc, folder, uid) lookup at fire time
|
|
2217
2217
|
// won't match — skip. If still at original (truly gone
|
|
2218
2218
|
// from server, not just moved), commit the delete.
|
|
2219
|
+
// Drafts/Sent never receive server-side Sieve moves — the long
|
|
2220
|
+
// grace only helps INBOX-class folders rebind moves. Worse, the
|
|
2221
|
+
// 30-min timer dies on every daemon restart and re-detection
|
|
2222
|
+
// restarts the clock, so on a restart-heavy day a sent-and-
|
|
2223
|
+
// deleted draft's local orphan NEVER got reaped (Bob 2026-07-13
|
|
2224
|
+
// "still getting sent messages left in drafts"). Short grace there.
|
|
2225
|
+
const quickReap = folder.specialUse === "drafts" || folder.specialUse === "sent" || folder.specialUse === "outbox";
|
|
2219
2226
|
for (const uid of toDelete) {
|
|
2220
|
-
this.scheduleDeferredReconcileDelete(accountId, folderId, uid, folder.path);
|
|
2227
|
+
this.scheduleDeferredReconcileDelete(accountId, folderId, uid, folder.path, quickReap ? 60_000 : undefined);
|
|
2221
2228
|
}
|
|
2222
|
-
console.log(` [reconcile-defer] ${accountId}/${folder.path}: scheduled ${toDelete.length} deletes (${ImapManager.RECONCILE_DELETE_GRACE_MS / 60_000}min grace
|
|
2229
|
+
console.log(` [reconcile-defer] ${accountId}/${folder.path}: scheduled ${toDelete.length} deletes (${quickReap ? "60s" : `${ImapManager.RECONCILE_DELETE_GRACE_MS / 60_000}min`} grace)`);
|
|
2223
2230
|
}
|
|
2224
2231
|
}
|
|
2225
2232
|
catch (e) {
|
|
@@ -3303,7 +3310,7 @@ export class ImapManager extends EventEmitter {
|
|
|
3303
3310
|
* in production — the grace expired and rows were committed-deleted
|
|
3304
3311
|
* before _Spam / Sent / archive folders had a chance to rebind. */
|
|
3305
3312
|
static RECONCILE_DELETE_GRACE_MS = 30 * 60_000;
|
|
3306
|
-
scheduleDeferredReconcileDelete(accountId, folderId, uid, folderPath) {
|
|
3313
|
+
scheduleDeferredReconcileDelete(accountId, folderId, uid, folderPath, graceMs) {
|
|
3307
3314
|
const key = `${accountId}:${folderId}:${uid}`;
|
|
3308
3315
|
// If already pending, don't reset — the grace clock runs from the
|
|
3309
3316
|
// FIRST detection so a flapping server can't keep deferring.
|
|
@@ -3341,7 +3348,7 @@ export class ImapManager extends EventEmitter {
|
|
|
3341
3348
|
}
|
|
3342
3349
|
this.db.recalcFolderCounts(folderId);
|
|
3343
3350
|
this.emit("folderCountsChanged", accountId, {});
|
|
3344
|
-
}, ImapManager.RECONCILE_DELETE_GRACE_MS);
|
|
3351
|
+
}, graceMs ?? ImapManager.RECONCILE_DELETE_GRACE_MS);
|
|
3345
3352
|
this.deferredDeletes.set(key, t);
|
|
3346
3353
|
}
|
|
3347
3354
|
/** Delete local rows whose uid >= the server's UIDNEXT for this folder.
|