1
0

fix: some bugs in snapshotSchedule

This commit is contained in:
alikia2x (寒寒) 2025-11-19 03:09:51 +08:00
parent 871a0f1f65
commit 558658feea
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 56209E0CCD8420C6
3 changed files with 5 additions and 4 deletions

View File

@ -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"
);

View File

@ -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);

View File

@ -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.`);
}