bulltrackers-module 1.0.706 → 1.0.707

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.
@@ -3,6 +3,7 @@
3
3
  * UPDATED: Added GCS Offloading logic (Hybrid Pointer System).
4
4
  * UPDATED: Preserved Legacy Sharding/Compression for backward compatibility.
5
5
  * UPDATED: Auto-cleanup of old Firestore shards when migrating a doc to GCS.
6
+ * FIXED: Disabled "Single Doc Compression" strategy during intermediate flushes to ensure consistent sharding.
6
7
  */
7
8
  const { commitBatchInChunks, generateDataHash, FieldValue } = require('../utils/utils');
8
9
  const { updateComputationStatus } = require('./StatusRepository');
@@ -366,7 +367,10 @@ async function writeSingleResult(result, docRef, name, dateContext, category, lo
366
367
  }
367
368
 
368
369
  // --- STRATEGY 2: FIRESTORE COMPRESSION ---
369
- if (totalSize > 50 * 1024) {
370
+ // FIX: Only compress if this is a single, atomic write (not part of a stream).
371
+ // Streaming relies on Strategy 3 (Sharding) to create distinct files (shard_0, shard_1...).
372
+ // If flushMode is INTERMEDIATE or we are already at a high shard index, we MUST fall through to sharding.
373
+ if (totalSize > 50 * 1024 && startShardIndex === 0 && flushMode !== 'INTERMEDIATE') {
370
374
  try {
371
375
  const compressedBuffer = zlib.gzipSync(rawBuffer);
372
376
  if (compressedBuffer.length < 900 * 1024) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.706",
3
+ "version": "1.0.707",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [