From 20731c0530075d540b7ec1a0189c6d10908daa79 Mon Sep 17 00:00:00 2001 From: alikia2x Date: Mon, 24 Mar 2025 04:05:22 +0800 Subject: [PATCH] test: debug for init window --- lib/db/snapshotSchedule.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/db/snapshotSchedule.ts b/lib/db/snapshotSchedule.ts index 4b0829e..8216dda 100644 --- a/lib/db/snapshotSchedule.ts +++ b/lib/db/snapshotSchedule.ts @@ -39,7 +39,8 @@ export async function refreshSnapshotWindowCounts(client: Client, redisClient: R for (const row of result.rows) { const targetOffset = Math.floor((row.window_start.getTime() - startTime) / (5 * MINUTE)); - const offset = (currentWindow + targetOffset) % WINDOW_SIZE; + const offset = (currentWindow + targetOffset); + logger.debug(`window_start: ${row.window_start}, count: ${row.count}, offset: ${offset}`); if (offset >= 0 && offset < WINDOW_SIZE) { await redisClient.hset(REDIS_KEY, offset.toString(), Number(row.count)); }