Skip to content

Commit 7f996d4

Browse files
committed
chore(): add batch size variable
1 parent 68cf956 commit 7f996d4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/models/eventsFactory.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const Event = require('../models/event');
77
const { ObjectID } = require('mongodb');
88
const { composeEventPayloadByRepetition } = require('../utils/merge');
99

10+
const MAX_DB_READ_BATCH_SIZE = 80000;
11+
1012
/**
1113
* @typedef {import('mongodb').UpdateWriteOpResult} UpdateWriteOpResult
1214
*/
@@ -424,7 +426,7 @@ class EventsFactory extends Factory {
424426

425427
let dailyEventsCursor = await this.getCollection(this.TYPES.DAILY_EVENTS)
426428
.find(options, { projection: { lastRepetitionTime: 1, groupingTimestamp: 1, count: 1 } })
427-
.batchSize(80_000);
429+
.batchSize(MAX_DB_READ_BATCH_SIZE);
428430

429431
const groupedCounts = {};
430432

0 commit comments

Comments
 (0)