mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-01-08 17:07:44 +08:00
prefer slave for imap fetch
This commit is contained in:
parent
b78107c7aa
commit
9bd34588c4
1 changed files with 12 additions and 0 deletions
|
@ -134,6 +134,7 @@ module.exports = (server, messageHandler, userCache) => (mailbox, options, sessi
|
|||
.find(query)
|
||||
.project(projection)
|
||||
.sort([['uid', 1]])
|
||||
.setReadPreference('secondaryPreferred')
|
||||
.maxTimeMS(consts.DB_MAX_TIME_MESSAGES);
|
||||
|
||||
let rowCount = 0;
|
||||
|
@ -141,6 +142,17 @@ module.exports = (server, messageHandler, userCache) => (mailbox, options, sessi
|
|||
let processNext = () => {
|
||||
cursor.next((err, messageData) => {
|
||||
if (err) {
|
||||
server.logger.error(
|
||||
{
|
||||
tnx: 'fetch',
|
||||
cid: session.id,
|
||||
err
|
||||
},
|
||||
'[%s] FETCHERR error=%s query=%s',
|
||||
session.id,
|
||||
err.message,
|
||||
JSON.stringify(query)
|
||||
);
|
||||
return done(err);
|
||||
}
|
||||
if (!messageData) {
|
||||
|
|
Loading…
Reference in a new issue