Fix some progress counts sort of

This commit is contained in:
2025-02-10 15:50:15 -05:00
parent 90379386d6
commit a9bccd4d01
3 changed files with 24 additions and 25 deletions

View File

@@ -40,7 +40,7 @@ async function calculateProductMetrics(startTime, totalProducts, processedCount
const SKIP_PRODUCT_TIME_AGGREGATES = 0;
if (isCancelled) {
outputProgress({
global.outputProgress({
status: 'cancelled',
operation: 'Product metrics calculation cancelled',
current: processedCount,
@@ -276,18 +276,17 @@ async function calculateProductMetrics(startTime, totalProducts, processedCount
]);
lastPid = batch[batch.length - 1].pid;
processedCount += batch.length;
myProcessedProducts += batch.length; // Increment the *module's* count
outputProgress({
status: 'running',
operation: 'Processing base metrics batch',
current: processedCount,
current: processedCount + myProcessedProducts, // Show cumulative progress
total: totalProducts,
elapsed: formatElapsedTime(startTime),
remaining: estimateRemaining(startTime, processedCount, totalProducts),
rate: calculateRate(startTime, processedCount),
percentage: ((processedCount / totalProducts) * 100).toFixed(1),
remaining: estimateRemaining(startTime, processedCount + myProcessedProducts, totalProducts),
rate: calculateRate(startTime, processedCount + myProcessedProducts),
percentage: (((processedCount + myProcessedProducts) / totalProducts) * 100).toFixed(1),
timing: {
start_time: new Date(startTime).toISOString(),
end_time: new Date().toISOString(),