add: log for collectMilestoneSnapshotsWorker

This commit is contained in:
alikia2x (寒寒) 2025-04-06 15:51:21 +08:00
parent 13ed20cf5c
commit 3a83df7954
Signed by: alikia2x
GPG Key ID: 56209E0CCD8420C6

View File

@ -154,6 +154,7 @@ export const collectMilestoneSnapshotsWorker = async (_job: Job) => {
for (const video of videos) { for (const video of videos) {
const aid = Number(video.aid); const aid = Number(video.aid);
const eta = await getAdjustedShortTermETA(client, aid); const eta = await getAdjustedShortTermETA(client, aid);
logger.log(`ETA for ${aid}: ${eta}`)
if (eta > 72) continue; if (eta > 72) continue;
const now = Date.now(); const now = Date.now();
const scheduledNextSnapshotDelay = eta * HOUR; const scheduledNextSnapshotDelay = eta * HOUR;
@ -162,6 +163,7 @@ export const collectMilestoneSnapshotsWorker = async (_job: Job) => {
const delay = truncate(scheduledNextSnapshotDelay, minInterval, maxInterval); const delay = truncate(scheduledNextSnapshotDelay, minInterval, maxInterval);
const targetTime = now + delay; const targetTime = now + delay;
await scheduleSnapshot(client, aid, "milestone", targetTime, true); await scheduleSnapshot(client, aid, "milestone", targetTime, true);
logger.log(`Scheduled milestone snapshot for aid ${aid} in ${(delay / MINUTE).toFixed(2)} mins.`, "mq");
} }
} catch (e) { } catch (e) {
logger.error(e as Error, "mq", "fn:collectMilestoneSnapshotsWorker"); logger.error(e as Error, "mq", "fn:collectMilestoneSnapshotsWorker");