fix: some bugs in snapshotSchedule
This commit is contained in:
parent
871a0f1f65
commit
558658feea
@ -235,7 +235,7 @@ export async function scheduleSnapshot(
|
||||
if (latestScheduleStartedAt > adjustedTime) {
|
||||
await sql`
|
||||
UPDATE snapshot_schedule
|
||||
SET started_at = ${adjustedTime}
|
||||
SET started_at = ${adjustedTime.toISOString()}
|
||||
WHERE id = ${latestActiveSchedule.id}
|
||||
`;
|
||||
logger.log(
|
||||
@ -251,7 +251,7 @@ export async function scheduleSnapshot(
|
||||
adjustedTime = await adjustSnapshotTime(new Date(targetTime), 3000, redis);
|
||||
}
|
||||
logger.log(
|
||||
`Scheduled snapshot for ${aid} at ${adjustedTime.toISOString()}`,
|
||||
`Scheduled ${type} snapshot for ${aid} at ${adjustedTime.toISOString()}`,
|
||||
"mq",
|
||||
"fn:scheduleSnapshot"
|
||||
);
|
||||
|
||||
@ -11,7 +11,7 @@ import { jobCounter, jobDurationRaw } from "metrics";
|
||||
export const dispatchMilestoneSnapshotsWorker = async (_job: Job) => {
|
||||
const start = Date.now();
|
||||
try {
|
||||
const videos = await getVideosNearMilestone(sql);
|
||||
const videos = await getVideosNearMilestone();
|
||||
for (const video of videos) {
|
||||
const aid = Number(video.aid);
|
||||
const eta = await getAdjustedShortTermETA(sql, aid);
|
||||
|
||||
@ -50,7 +50,8 @@ async function addCandidates() {
|
||||
for (const aid of newAids) {
|
||||
stmt += `INSERT OR IGNORE INTO bili_info_crawl (aid, status) VALUES (${aid}, 'pending');\n`;
|
||||
}
|
||||
sqlite.prepare(stmt).run();
|
||||
await Bun.file("1.sql").write(stmt);
|
||||
sqlite.exec(stmt);
|
||||
logger.log(`Added ${newAids.length} to local DB.`);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user