mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-03-01 18:35:09 +08:00
fixed cursor leak in restore task
This commit is contained in:
parent
179c537e4b
commit
24229569e3
1 changed files with 8 additions and 8 deletions
|
@ -6,14 +6,6 @@ const db = require('../db');
|
|||
module.exports = (taskData, options, callback) => {
|
||||
const messageHandler = options.messageHandler;
|
||||
|
||||
let cursor = db.database.collection('archived').find({
|
||||
user: taskData.user,
|
||||
archived: {
|
||||
$gte: taskData.start,
|
||||
$lte: taskData.end
|
||||
}
|
||||
});
|
||||
|
||||
db.users.collection('users').findOne({ _id: taskData.user }, (err, userData) => {
|
||||
if (err) {
|
||||
log.error('Tasks', 'task=restore id=%s user=%s error=%s', taskData._id, taskData.user, err.message);
|
||||
|
@ -50,6 +42,14 @@ module.exports = (taskData, options, callback) => {
|
|||
}
|
||||
});
|
||||
|
||||
let cursor = db.database.collection('archived').find({
|
||||
user: taskData.user,
|
||||
archived: {
|
||||
$gte: taskData.start,
|
||||
$lte: taskData.end
|
||||
}
|
||||
});
|
||||
|
||||
let processNext = () => {
|
||||
cursor.next((err, messageData) => {
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in a new issue