mirror of
https://github.com/Crazyco-xyz/48hr.email.git
synced 2026-01-11 11:49:35 +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,12 +296,16 @@ class ImapService extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(`Deleting mails ${toDelete}`);
|
debug(`Deleting mails ${toDelete}`);
|
||||||
await this.connection.deleteMessage(toDelete);
|
// Batch deletes to avoid IMAP argument limits
|
||||||
|
const BATCH_SIZE = 100;
|
||||||
toDelete.forEach(uid => {
|
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);
|
this.emit(ImapService.EVENT_DELETED_MAIL, uid);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue