bulltrackers-module 1.0.45 → 1.0.47
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.
- package/functions/core/utils/firestore_utils.js +1 -1
- package/functions/task-engine/handler_creator.js +5 -0
- package/functions/task-engine/helpers/discover_helpers.js +1 -1
- package/functions/task-engine/helpers/update_helpers.js +1 -1
- package/functions/task-engine/helpers/verify_helpers.js +1 -1
- package/package.json +1 -1
|
@@ -229,7 +229,7 @@ async function getPrioritizedSpeculators(exclusionIds, speculatorInstrumentSet,
|
|
|
229
229
|
* @returns {Promise<void>}
|
|
230
230
|
*/
|
|
231
231
|
async function clearCollection(collectionPath) {
|
|
232
|
-
logger.log('WARN', `[Core Utils] Starting SCORCHED EARTH delete for collection: ${collectionPath}...`);
|
|
232
|
+
logger.log('WARN', `[Core Utils] Starting SCORCHED EARTH delete for collection: ${collectionPath}...`); // Note, don't fuck up, this is irreversible.
|
|
233
233
|
try {
|
|
234
234
|
const collectionRef = db.collection(collectionPath);
|
|
235
235
|
const batchSize = MAX_FIRESTORE_BATCH_SIZE;
|
|
@@ -85,10 +85,15 @@ function createTaskEngineHandler(config, dependencies = {}) {
|
|
|
85
85
|
} catch (error) {
|
|
86
86
|
logger.log('ERROR', `[TaskEngine/${taskId}] Failed.`, { errorMessage: error.message, errorStack: error.stack });
|
|
87
87
|
} finally {
|
|
88
|
+
// --- START BUG FIX ---
|
|
88
89
|
try {
|
|
90
|
+
// Flush any remaining items in the batch
|
|
91
|
+
await CLIENTS.batchManager.flushBatches();
|
|
92
|
+
logger.log('INFO', `[TaskEngine/${taskId}] Final batch flush complete.`);
|
|
89
93
|
} catch (flushError) {
|
|
90
94
|
logger.log('ERROR', `[TaskEngine/${taskId}] Error during final flush attempt.`, { error: flushError.message });
|
|
91
95
|
}
|
|
96
|
+
// --- END BUG FIX ---
|
|
92
97
|
}
|
|
93
98
|
};
|
|
94
99
|
}
|
|
@@ -23,7 +23,7 @@ async function handleDiscover(task, taskId, clients, config) {
|
|
|
23
23
|
logger.log('INFO', `[DISCOVER] Added ${cids.length} speculator CIDs to the in-memory set to be flushed.`);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const response = await clients.proxyManager.fetch(url, {
|
|
27
27
|
method: 'POST',
|
|
28
28
|
headers: { ...selectedHeader.headers, 'Content-Type': 'application/json' },
|
|
29
29
|
body: JSON.stringify(cids),
|
|
@@ -23,7 +23,7 @@ async function handleUpdate(task, taskId, clients, config) {
|
|
|
23
23
|
: `${config.ETORO_API_PORTFOLIO_URL}?cid=${userId}`;
|
|
24
24
|
|
|
25
25
|
logger.log('INFO', `[UPDATE] Fetching portfolio for user ${userId} (${userType} with url ${url})`);
|
|
26
|
-
const
|
|
26
|
+
const response = await clients.proxyManager.fetch(url, { headers: selectedHeader.headers });
|
|
27
27
|
// Add this check
|
|
28
28
|
if (!response || typeof response.text !== 'function') {
|
|
29
29
|
// Log the problematic response object for debugging
|
|
@@ -31,7 +31,7 @@ async function handleVerify(task, taskId, clients, config) {
|
|
|
31
31
|
|
|
32
32
|
let wasSuccess = false;
|
|
33
33
|
try {
|
|
34
|
-
const
|
|
34
|
+
const response = await clients.proxyManager.fetch(portfolioUrl, { headers: selectedHeader.headers });
|
|
35
35
|
if (!response.ok) continue;
|
|
36
36
|
wasSuccess = true;
|
|
37
37
|
|