Do not use sorting for mass action tasks

This commit is contained in:
Andris Reinman 2022-12-22 09:49:28 +02:00
parent fd8b65b11f
commit 1aa9b9e14a
No known key found for this signature in database
GPG key ID: DC6C83F4D584D364

View file

@ -35,7 +35,7 @@ let run = async (task, data, options) => {
}
}
let cursor = await db.database.collection('messages').find(filter).sort({ uid: -1 });
let cursor = await db.database.collection('messages').find(filter);
let messageData;
@ -51,18 +51,6 @@ let run = async (task, data, options) => {
if (action.moveTo && action.moveTo.toString() !== messageData.mailbox.toString()) {
try {
console.log({
user,
source: {
user: messageData.user,
mailbox: messageData.mailbox
},
destination: {
mailbox: mailboxData._id
},
updates: Object.keys(updates).length ? updates : false,
messageQuery: messageData.uid
});
await moveMessage({
user,
source: {