mirror of
https://github.com/Crazyco-xyz/48hr.email.git
synced 2026-01-09 19:29:34 +01:00
[Fix]: Large purge failures
I swear writing a tempmail service is hard
This commit is contained in:
parent
f8ce98a584
commit
b8b198125d
1 changed files with 9 additions and 5 deletions
|
|
@ -296,11 +296,15 @@ class ImapService extends EventEmitter {
|
|||
}
|
||||
|
||||
debug(`Deleting mails ${toDelete}`);
|
||||
await this.connection.deleteMessage(toDelete);
|
||||
|
||||
toDelete.forEach(uid => {
|
||||
this.emit(ImapService.EVENT_DELETED_MAIL, uid);
|
||||
});
|
||||
// Batch deletes to avoid IMAP argument limits
|
||||
const BATCH_SIZE = 100;
|
||||
for (let i = 0; i < toDelete.length; i += BATCH_SIZE) {
|
||||
const batch = toDelete.slice(i, i + BATCH_SIZE);
|
||||
await this.connection.deleteMessage(batch);
|
||||
batch.forEach(uid => {
|
||||
this.emit(ImapService.EVENT_DELETED_MAIL, uid);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue