bulltrackers-module 1.0.251 → 1.0.252
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.
|
@@ -10,7 +10,9 @@ const pLimit = require('p-limit');
|
|
|
10
10
|
// Hardcoded verification blocks as per logic requirements
|
|
11
11
|
const CANARY_BLOCK_ID = '19M';
|
|
12
12
|
const CANARY_PART_ID = 'part_0';
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
// [FIX] Hardcoded to 'shard_0' based on your confirmed data path (/asset_prices/shard_0)
|
|
15
|
+
const PRICE_SHARD_ID = 'shard_0';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Main pipe: pipe.maintenance.runRootDataIndexer
|
|
@@ -23,18 +25,21 @@ exports.runRootDataIndexer = async (config, dependencies) => {
|
|
|
23
25
|
collections
|
|
24
26
|
} = config;
|
|
25
27
|
|
|
28
|
+
// [FIX] Hardcode the collection name to ignore any incorrect config values
|
|
29
|
+
const PRICE_COLLECTION_NAME = 'asset_prices';
|
|
30
|
+
|
|
26
31
|
logger.log('INFO', '[RootDataIndexer] Starting Root Data Availability Scan...');
|
|
27
32
|
|
|
28
33
|
// 1. Pre-fetch Price Data Availability (Optimization)
|
|
29
|
-
// Instead of reading the shard N times, we read it once and map available dates.
|
|
30
34
|
const priceAvailabilitySet = new Set();
|
|
31
35
|
|
|
32
36
|
// --- DEBUGGING START ---
|
|
33
|
-
logger.log('INFO', `[RootDataIndexer] DEBUG: Attempting to fetch price shard. Collection: "${
|
|
37
|
+
logger.log('INFO', `[RootDataIndexer] DEBUG: Attempting to fetch price shard. Collection: "${PRICE_COLLECTION_NAME}", Doc ID: "${PRICE_SHARD_ID}"`);
|
|
34
38
|
// --- DEBUGGING END ---
|
|
35
39
|
|
|
36
40
|
try {
|
|
37
|
-
|
|
41
|
+
// [FIX] Use the hardcoded collection name
|
|
42
|
+
const priceShardRef = db.collection(PRICE_COLLECTION_NAME).doc(PRICE_SHARD_ID);
|
|
38
43
|
const priceSnap = await priceShardRef.get();
|
|
39
44
|
|
|
40
45
|
if (priceSnap.exists) {
|
|
@@ -68,16 +73,13 @@ exports.runRootDataIndexer = async (config, dependencies) => {
|
|
|
68
73
|
// Validate format YYYY-MM-DD
|
|
69
74
|
if (/^\d{4}-\d{2}-\d{2}$/.test(dateKey)) {
|
|
70
75
|
priceAvailabilitySet.add(dateKey);
|
|
71
|
-
} else {
|
|
72
|
-
// Log regex failures occasionally
|
|
73
|
-
if (Math.random() < 0.001) logger.log('WARN', `[RootDataIndexer] DEBUG: Date key "${dateKey}" failed regex validation.`);
|
|
74
76
|
}
|
|
75
77
|
});
|
|
76
78
|
}
|
|
77
79
|
});
|
|
78
80
|
} else {
|
|
79
81
|
// --- DEBUGGING START ---
|
|
80
|
-
logger.log('ERROR', `[RootDataIndexer] DEBUG: 🛑 FATAL: Document "${PRICE_SHARD_ID}" does NOT exist in collection "${
|
|
82
|
+
logger.log('ERROR', `[RootDataIndexer] DEBUG: 🛑 FATAL: Document "${PRICE_SHARD_ID}" does NOT exist in collection "${PRICE_COLLECTION_NAME}". Price availability will be false for all dates.`);
|
|
81
83
|
// --- DEBUGGING END ---
|
|
82
84
|
}
|
|
83
85
|
logger.log('INFO', `[RootDataIndexer] Loaded price availability map. Found prices for ${priceAvailabilitySet.size} unique dates.`);
|