mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-01-10 01:48:38 +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)
|
.find(query)
|
||||||
.project(projection)
|
.project(projection)
|
||||||
.sort([['uid', 1]])
|
.sort([['uid', 1]])
|
||||||
|
.setReadPreference('secondaryPreferred')
|
||||||
.maxTimeMS(consts.DB_MAX_TIME_MESSAGES);
|
.maxTimeMS(consts.DB_MAX_TIME_MESSAGES);
|
||||||
|
|
||||||
let rowCount = 0;
|
let rowCount = 0;
|
||||||
|
@ -141,6 +142,17 @@ module.exports = (server, messageHandler, userCache) => (mailbox, options, sessi
|
||||||
let processNext = () => {
|
let processNext = () => {
|
||||||
cursor.next((err, messageData) => {
|
cursor.next((err, messageData) => {
|
||||||
if (err) {
|
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);
|
return done(err);
|
||||||
}
|
}
|
||||||
if (!messageData) {
|
if (!messageData) {
|
||||||
|
|
Loading…
Reference in a new issue