add: log for collectMilestoneSnapshotsWorker
This commit is contained in:
parent
13ed20cf5c
commit
3a83df7954
@ -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");
|
||||||
|
Loading…
Reference in New Issue
Block a user