From 584a1be9f9b292c89f73c78861001bfcfb7f5674 Mon Sep 17 00:00:00 2001 From: alikia2x Date: Mon, 24 Mar 2025 04:08:34 +0800 Subject: [PATCH] test: debug for adjusting snapshot time --- lib/db/snapshotSchedule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/db/snapshotSchedule.ts b/lib/db/snapshotSchedule.ts index 8216dda..e5a98ee 100644 --- a/lib/db/snapshotSchedule.ts +++ b/lib/db/snapshotSchedule.ts @@ -40,7 +40,6 @@ 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); - 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)); } @@ -188,6 +187,7 @@ export async function adjustSnapshotTime( for (let i = 0; i < WINDOW_SIZE; i++) { const offset = (currentWindow + targetOffset + i) % WINDOW_SIZE; const count = await getWindowCount(redisClient, offset); + logger.debug(`offset: ${offset}, count: ${count}, expectedStartTime: ${expectedStartTime}`); if (count < allowedCounts) { // 找到可用窗口,更新计数