fix: missing entrance for schedule type 'new'

update: perf log text
This commit is contained in:
alikia2x (寒寒) 2025-03-25 22:58:56 +08:00
parent 17ded63758
commit cabb360a16
Signed by: alikia2x
GPG Key ID: 56209E0CCD8420C6
2 changed files with 6 additions and 3 deletions

View File

@ -201,18 +201,18 @@ export async function adjustSnapshotTime(
if (delayedDate.getTime() < now.getTime()) { if (delayedDate.getTime() < now.getTime()) {
const elapsed = performance.now() - t; const elapsed = performance.now() - t;
timePerIteration = elapsed / i; timePerIteration = elapsed / i;
logger.log(`Time per iteration: ${timePerIteration.toFixed(3)}ms`, "perf", "fn:adjustSnapshotTime"); logger.log(`${timePerIteration.toFixed(3)}ms * ${i}iterations`, "perf", "fn:adjustSnapshotTime");
return now; return now;
} }
const elapsed = performance.now() - t; const elapsed = performance.now() - t;
timePerIteration = elapsed / i; timePerIteration = elapsed / i;
logger.log(`Time per iteration: ${timePerIteration.toFixed(3)}ms`, "perf", "fn:adjustSnapshotTime"); logger.log(`${timePerIteration.toFixed(3)}ms * ${i}iterations`, "perf", "fn:adjustSnapshotTime");
return delayedDate; return delayedDate;
} }
} }
const elapsed = performance.now() - t; const elapsed = performance.now() - t;
timePerIteration = elapsed / WINDOW_SIZE; timePerIteration = elapsed / WINDOW_SIZE;
logger.log(`Time per iteration: ${timePerIteration.toFixed(3)}ms`, "perf", "fn:adjustSnapshotTime"); logger.log(`${timePerIteration.toFixed(3)}ms * ${WINDOW_SIZE}iterations`, "perf", "fn:adjustSnapshotTime");
return expectedStartTime; return expectedStartTime;
} }

View File

@ -7,6 +7,8 @@ import logger from "lib/log/logger.ts";
import { lockManager } from "lib/mq/lockManager.ts"; import { lockManager } from "lib/mq/lockManager.ts";
import { aidExistsInSongs } from "lib/db/songs.ts"; import { aidExistsInSongs } from "lib/db/songs.ts";
import { insertIntoSongs } from "lib/mq/task/collectSongs.ts"; import { insertIntoSongs } from "lib/mq/task/collectSongs.ts";
import { scheduleSnapshot } from "lib/db/snapshotSchedule.ts";
import { MINUTE } from "$std/datetime/constants.ts";
export const classifyVideoWorker = async (job: Job) => { export const classifyVideoWorker = async (job: Job) => {
const client = await db.connect(); const client = await db.connect();
@ -27,6 +29,7 @@ export const classifyVideoWorker = async (job: Job) => {
const exists = await aidExistsInSongs(client, aid); const exists = await aidExistsInSongs(client, aid);
if (!exists && label !== 0) { if (!exists && label !== 0) {
await scheduleSnapshot(client, aid, "new", Date.now() + 10 * MINUTE, true);
await insertIntoSongs(client, aid); await insertIntoSongs(client, aid);
} }