do not count stats only for a single page

This commit is contained in:
Andris Reinman 2021-11-02 15:55:29 +02:00
parent 803e21a9a8
commit be50d27467
No known key found for this signature in database
GPG key ID: DC6C83F4D584D364

View file

@ -130,6 +130,10 @@ module.exports = (server, messageHandler, userCache) => (mailbox, options, sessi
let lastUid = false;
let startTime = Date.now();
let rowCount = 0;
let totalBytes = 0;
// instead of fetching all messages at once from a large mailbox
// we page it into smaller queries
let processPage = () => {
@ -174,9 +178,6 @@ module.exports = (server, messageHandler, userCache) => (mailbox, options, sessi
cursor = cursor.batchSize(1000);
}
let startTime = Date.now();
let rowCount = 0;
let totalBytes = 0;
let processedCount = 0;
let processNext = () => {
cursor.next((err, messageData) => {