@bobfrankston/mailx 1.0.300 → 1.0.301
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/package.json +1 -1
- package/packages/mailx-imap/index.js +12 -2
package/package.json
CHANGED
|
@@ -659,8 +659,18 @@ export class ImapManager extends EventEmitter {
|
|
|
659
659
|
let messages;
|
|
660
660
|
const firstSync = highestUid === 0;
|
|
661
661
|
const historyDays = getHistoryDays(accountId);
|
|
662
|
-
//
|
|
663
|
-
|
|
662
|
+
// IMAP: historyDays=0 (unlimited) is dangerous — "SEARCH SINCE 1970"
|
|
663
|
+
// asks the server to enumerate every message, which Dovecot times out
|
|
664
|
+
// on (300s). Cap at 90 days for IMAP. Gmail API handles 0 fine via
|
|
665
|
+
// pagination. The first-sync cap (30) applies when starting from
|
|
666
|
+
// scratch so the UI isn't empty for minutes.
|
|
667
|
+
const isGmail = this.isGmailAccount(accountId);
|
|
668
|
+
const MAX_IMAP_DAYS = 90;
|
|
669
|
+
let effectiveDays = historyDays;
|
|
670
|
+
if (historyDays === 0 && !isGmail)
|
|
671
|
+
effectiveDays = MAX_IMAP_DAYS;
|
|
672
|
+
if (effectiveDays === 0 && firstSync)
|
|
673
|
+
effectiveDays = 30;
|
|
664
674
|
const startDate = effectiveDays > 0
|
|
665
675
|
? new Date(Date.now() - effectiveDays * 86400000)
|
|
666
676
|
: new Date(0);
|