bulltrackers-module 1.0.124 → 1.0.125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,10 +120,11 @@ class FirestoreBatchManager {
120
120
  this.tradingHistoryBatch[basePath][userId] = historyData;
121
121
 
122
122
  // Trigger flush based on portfolio batch size, assuming they'll be roughly equal
123
- const totalUsersInBatch = Object.values(this.portfolioBatch).reduce((sum, users) => sum + Object.keys(users).length, 0);
123
+ const totalUsersInBatch = Object.values(this.tradingHistoryBatch).reduce((sum, users) => sum + Object.keys(users).length, 0);
124
124
 
125
125
  if (totalUsersInBatch >= this.config.TASK_ENGINE_MAX_BATCH_SIZE) {
126
- await this.flushBatches();
126
+ // DO NOT await a flush. Just schedule one.
127
+ this._scheduleFlush();
127
128
  } else {
128
129
  this._scheduleFlush();
129
130
  }
@@ -153,7 +154,8 @@ class FirestoreBatchManager {
153
154
  const totalUsersInBatch = Object.values(this.portfolioBatch).reduce((sum, users) => sum + Object.keys(users).length, 0);
154
155
 
155
156
  if (totalUsersInBatch >= this.config.TASK_ENGINE_MAX_BATCH_SIZE) {
156
- await this.flushBatches();
157
+ // DO NOT await a flush. Just schedule one.
158
+ this._scheduleFlush();
157
159
  } else {
158
160
  this._scheduleFlush();
159
161
  }
@@ -180,7 +182,8 @@ class FirestoreBatchManager {
180
182
  this.timestampBatch[docPath][timestampKey] = new Date();
181
183
 
182
184
  if (Object.keys(this.timestampBatch[docPath]).length >= this.config.TASK_ENGINE_MAX_BATCH_SIZE) {
183
- await this.flushBatches();
185
+ // DO NOT await a flush. Just schedule one.
186
+ this._scheduleFlush();
184
187
  } else {
185
188
  this._scheduleFlush();
186
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.124",
3
+ "version": "1.0.125",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [