From 95e415ed133dd154d8791307dfa11755b6446a88 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Wed, 17 Dec 2025 19:27:20 +0000 Subject: [PATCH] comments --- server/src/services/infrastructure/JobGenerator.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/src/services/infrastructure/JobGenerator.ts b/server/src/services/infrastructure/JobGenerator.ts index 807c34da4..6f366bcd6 100644 --- a/server/src/services/infrastructure/JobGenerator.ts +++ b/server/src/services/infrastructure/JobGenerator.ts @@ -142,10 +142,9 @@ class JobGenerator implements IJobGenerator { }; }; - // Aggregates stats for the previous UTC hour and (at UTC midnight) the previous UTC day generateStatsAggregationJob = () => { return async () => { - // Compute previous hour window in UTC + // Get previous hour window in UTC const now = new Date(); const utcNow = new Date( Date.UTC( @@ -174,7 +173,7 @@ class JobGenerator implements IJobGenerator { // Upsert hourly stats for the last full hour await this.statsAggregationService.upsertHourly(hourStart, hourEnd); - // Roll up the current day-so-far (not finalized) so charts have partial daily data + // Roll up the current day so far so we have partial data for the current day const todayStart = new Date( Date.UTC( now.getUTCFullYear(), @@ -188,7 +187,7 @@ class JobGenerator implements IJobGenerator { ); await this.statsAggregationService.rollupDaily(todayStart, utcNow, false); - // If at UTC midnight hour (i.e., hour just rolled over), finalize the previous day + // If at UTC midnight hour finalize the previous day const hour = utcNow.getUTCHours(); if (hour === 0) { const dayEnd = todayStart; // just reached 00:00, previous day ends now