bulltrackers-module 1.0.169 → 1.0.170
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.
|
@@ -43,8 +43,7 @@ async function dispatchUpdates(targets, userType, config, dependencies) {
|
|
|
43
43
|
const { dispatcherTopicName, taskBatchSize, pubsubBatchSize } = config;
|
|
44
44
|
if (targets.length === 0) { logger.log('INFO', `[Orchestrator Helpers] No ${userType} update targets to dispatch.`); return; }
|
|
45
45
|
logger.log('INFO', `[Orchestrator Helpers] Dispatching ${targets.length} update tasks for ${userType} to ${dispatcherTopicName}...`);
|
|
46
|
-
const individualTasks = targets.map(target => ({ type: 'update', userId: userType === 'normal' ? target : target.userId,
|
|
47
|
-
const dispatcherMessages = [];
|
|
46
|
+
const individualTasks = targets.map(target => ({ type: 'update', userId: userType === 'normal' ? target : target.userId, instruments: userType === 'speculator' ? target.instruments : undefined, userType })); const dispatcherMessages = [];
|
|
48
47
|
for (let i = 0; i < individualTasks.length; i += taskBatchSize) { dispatcherMessages.push({ tasks: individualTasks.slice(i, i + taskBatchSize) }); }
|
|
49
48
|
try { await pubsubUtils.batchPublishTasks(dependencies,{ topicName: dispatcherTopicName, tasks: dispatcherMessages, taskType: `${userType} update batch`, maxPubsubBatchSize: pubsubBatchSize }); logger.log('SUCCESS', `[Orchestrator Helpers] Published ${dispatcherMessages.length} messages (${individualTasks.length} tasks) for ${userType} updates to the dispatcher.`); }
|
|
50
49
|
catch (error) { logger.log('ERROR', `[Orchestrator Helpers] Error dispatching update tasks for ${userType}`, { errorMessage: error.message }); throw error; }}
|
|
@@ -273,7 +273,7 @@ async function handleUpdate(task, taskId, { logger, headerManager, proxyManager,
|
|
|
273
273
|
if (isPrivate) {
|
|
274
274
|
logger.log('WARN', `[handleUpdate/${userId}] Removing private user from updates.`);
|
|
275
275
|
for (const instrumentId of instrumentsToProcess) {
|
|
276
|
-
await batchManager.deleteFromTimestampBatch(userId, userType,
|
|
276
|
+
await batchManager.deleteFromTimestampBatch(userId, userType, instId);
|
|
277
277
|
}
|
|
278
278
|
const blockCountsRef = db.doc(config.FIRESTORE_DOC_SPECULATOR_BLOCK_COUNTS);
|
|
279
279
|
for (const instrumentId of instrumentsToProcess) {
|
|
@@ -285,7 +285,7 @@ async function handleUpdate(task, taskId, { logger, headerManager, proxyManager,
|
|
|
285
285
|
|
|
286
286
|
// If not private, update all timestamps
|
|
287
287
|
for (const instrumentId of instrumentsToProcess) {
|
|
288
|
-
await batchManager.updateUserTimestamp(userId, userType,
|
|
288
|
+
await batchManager.updateUserTimestamp(userId, userType, instId);
|
|
289
289
|
}
|
|
290
290
|
if (userType === 'speculator') {
|
|
291
291
|
await batchManager.addSpeculatorTimestampFix(userId, String(Math.floor(userId/1e6)*1e6));
|