Potential fix?

main
ClaraCrazy 2024-11-11 19:15:19 +01:00
parent 2636f5f56a
commit f2e6923953
No known key found for this signature in database
GPG Key ID: EBBC896ACB497011
1 changed files with 4 additions and 3 deletions

View File

@ -202,15 +202,16 @@ class ImapService extends EventEmitter {
async deleteOldMails(deleteMailsBefore) { async deleteOldMails(deleteMailsBefore) {
let uids = [] let uids = []
if (helper.moreThanOneDay(moment(), deleteMailsBefore)) { if (helper.moreThanOneDay(moment(), deleteMailsBefore)) {
//fetch mails from date -1day (calculated in MS) to avoid wasting resources
deleteMailsBefore = deleteMailsBefore - 24 * 60 * 60 * 1000
uids = await this._searchWithoutFetch([ uids = await this._searchWithoutFetch([
['!DELETED'], ['!DELETED'],
['BEFORE', deleteMailsBefore] ['BEFORE', deleteMailsBefore]
]) ])
} else { } else {
//fetch mails from date -1day (calculated in MS) to avoid wasting resources
deleteMailsBefore = new Date(moment() - 24 * 60 * 60 * 1000)
uids = await this._searchWithoutFetch([ uids = await this._searchWithoutFetch([
['!DELETED'] ['!DELETED'],
['BEFORE', deleteMailsBefore]
]) ])
} }