From 2d0b1532e66080711c72eea436039412f937f000 Mon Sep 17 00:00:00 2001 From: e11sy <130844513+e11sy@users.noreply.github.com> Date: Sat, 11 Oct 2025 01:41:18 +0300 Subject: [PATCH 1/6] chore(): add env variable for max batch size --- .env.sample | 2 ++ src/models/eventsFactory.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index 2f8fdd74..efbdd12e 100644 --- a/.env.sample +++ b/.env.sample @@ -20,6 +20,8 @@ JWT_SECRET_REFRESH_TOKEN=abacaba # JWT secret for user's access token JWT_SECRET_ACCESS_TOKEN=belarus +# max document could for one read request to the database +MAX_DB_READ_BATCH_SIZE=100000 # JWT secret for signing tokens for processing billing requests JWT_SECRET_BILLING_CHECKSUM=checksum_secret diff --git a/src/models/eventsFactory.js b/src/models/eventsFactory.js index d294043b..d341366c 100644 --- a/src/models/eventsFactory.js +++ b/src/models/eventsFactory.js @@ -7,7 +7,7 @@ const Event = require('../models/event'); const { ObjectID } = require('mongodb'); const { composeEventPayloadByRepetition } = require('../utils/merge'); -const MAX_DB_READ_BATCH_SIZE = 80000; +const MAX_DB_READ_BATCH_SIZE = process.env.MAX_DB_READ_BATCH_SIZE; /** * @typedef {import('mongodb').UpdateWriteOpResult} UpdateWriteOpResult From 63bc8c9685c2e172eeadd18face9ef06da18f34c Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:42:37 +0000 Subject: [PATCH 2/6] Bump version up to 1.2.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8ab87869..2a6f2a42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hawk.api", - "version": "1.2.1", + "version": "1.2.2", "main": "index.ts", "license": "BUSL-1.1", "scripts": { From 0a9585023c861ccec8d1e58331b20bfc8f09c96b Mon Sep 17 00:00:00 2001 From: e11sy <130844513+e11sy@users.noreply.github.com> Date: Sat, 11 Oct 2025 01:59:02 +0300 Subject: [PATCH 3/6] chore(): cast env to number --- src/models/eventsFactory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/eventsFactory.js b/src/models/eventsFactory.js index d341366c..8ed1bb4e 100644 --- a/src/models/eventsFactory.js +++ b/src/models/eventsFactory.js @@ -7,7 +7,7 @@ const Event = require('../models/event'); const { ObjectID } = require('mongodb'); const { composeEventPayloadByRepetition } = require('../utils/merge'); -const MAX_DB_READ_BATCH_SIZE = process.env.MAX_DB_READ_BATCH_SIZE; +const MAX_DB_READ_BATCH_SIZE = Number(process.env.MAX_DB_READ_BATCH_SIZE ?? 0); /** * @typedef {import('mongodb').UpdateWriteOpResult} UpdateWriteOpResult From 41f9210b077c43581cd3472854c7cd5483c0346f Mon Sep 17 00:00:00 2001 From: e11sy <130844513+e11sy@users.noreply.github.com> Date: Sat, 11 Oct 2025 02:02:12 +0300 Subject: [PATCH 4/6] chore(): set default --- src/models/eventsFactory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/eventsFactory.js b/src/models/eventsFactory.js index 8ed1bb4e..651976ba 100644 --- a/src/models/eventsFactory.js +++ b/src/models/eventsFactory.js @@ -7,7 +7,7 @@ const Event = require('../models/event'); const { ObjectID } = require('mongodb'); const { composeEventPayloadByRepetition } = require('../utils/merge'); -const MAX_DB_READ_BATCH_SIZE = Number(process.env.MAX_DB_READ_BATCH_SIZE ?? 0); +const MAX_DB_READ_BATCH_SIZE = Number(process.env.MAX_DB_READ_BATCH_SIZE ?? 1000); /** * @typedef {import('mongodb').UpdateWriteOpResult} UpdateWriteOpResult From b4dc4cbe468324ef6748a59ec197ec213f199f29 Mon Sep 17 00:00:00 2001 From: e11sy <130844513+e11sy@users.noreply.github.com> Date: Sat, 11 Oct 2025 02:04:15 +0300 Subject: [PATCH 5/6] chore(): fix --- src/models/eventsFactory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/eventsFactory.js b/src/models/eventsFactory.js index 651976ba..d10f3aad 100644 --- a/src/models/eventsFactory.js +++ b/src/models/eventsFactory.js @@ -7,7 +7,7 @@ const Event = require('../models/event'); const { ObjectID } = require('mongodb'); const { composeEventPayloadByRepetition } = require('../utils/merge'); -const MAX_DB_READ_BATCH_SIZE = Number(process.env.MAX_DB_READ_BATCH_SIZE ?? 1000); +const MAX_DB_READ_BATCH_SIZE = Number(process.env.MAX_DB_READ_BATCH_SIZE); /** * @typedef {import('mongodb').UpdateWriteOpResult} UpdateWriteOpResult From 6a4d5b57968d64ed823168fa435de25c5e4db508 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 23:08:10 +0000 Subject: [PATCH 6/6] Bump version up to 1.2.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2a6f2a42..7f90e788 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hawk.api", - "version": "1.2.2", + "version": "1.2.3", "main": "index.ts", "license": "BUSL-1.1", "scripts": {