mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-01-01 13:13:53 +08:00
ensure cursor close
This commit is contained in:
parent
60300f82a1
commit
6773863038
2 changed files with 12 additions and 6 deletions
12
imap.js
12
imap.js
|
@ -1003,12 +1003,16 @@ server.onCopy = function (path, update, session, callback) {
|
|||
uidNext: true
|
||||
}, (err, item) => {
|
||||
if (err) {
|
||||
return updateQuota(() => callback(err));
|
||||
return cursor.close(() => {
|
||||
updateQuota(() => callback(err));
|
||||
});
|
||||
}
|
||||
|
||||
if (!item || !item.value) {
|
||||
// was not able to acquire a lock
|
||||
return updateQuota(() => callback(null, 'TRYCREATE'));
|
||||
return cursor.close(() => {
|
||||
updateQuota(() => callback(null, 'TRYCREATE'));
|
||||
});
|
||||
}
|
||||
|
||||
let uidNext = item.value.uidNext;
|
||||
|
@ -1029,7 +1033,9 @@ server.onCopy = function (path, update, session, callback) {
|
|||
|
||||
db.database.collection('messages').insertOne(message, err => {
|
||||
if (err) {
|
||||
return updateQuota(() => callback(err));
|
||||
return cursor.close(() => {
|
||||
updateQuota(() => callback(err));
|
||||
});
|
||||
}
|
||||
|
||||
copiedMessages++;
|
||||
|
|
|
@ -611,11 +611,11 @@ class MessageHandler {
|
|||
uidNext: true
|
||||
}, (err, item) => {
|
||||
if (err) {
|
||||
return done(err);
|
||||
return cursor.close(() => done(err));
|
||||
}
|
||||
|
||||
if (!item || !item.value) {
|
||||
return done(new Error('Mailbox disappeared'));
|
||||
return cursor.close(() => done(new Error('Mailbox disappeared')));
|
||||
}
|
||||
|
||||
let uidNext = item.value.uidNext;
|
||||
|
@ -647,7 +647,7 @@ class MessageHandler {
|
|||
_id: message._id
|
||||
}, updateOptions, err => {
|
||||
if (err) {
|
||||
return done(err);
|
||||
return cursor.close(() => done(err));
|
||||
}
|
||||
|
||||
if (options.session) {
|
||||
|
|
Loading…
Reference in a new issue