fix: bigint serialization failed

This commit is contained in:
alikia2x (寒寒) 2025-03-27 03:15:35 +08:00
parent d8201c7f8e
commit 767e19b425
Signed by: alikia2x
GPG Key ID: 56209E0CCD8420C6

View File

@ -47,20 +47,21 @@ export const snapshotTickWorker = async (_job: Job) => {
const groups = Math.ceil(count / 30); const groups = Math.ceil(count / 30);
for (let i = 0; i < groups; i++) { for (let i = 0; i < groups; i++) {
const group = schedules.slice(i * 30, (i + 1) * 30); const group = schedules.slice(i * 30, (i + 1) * 30);
const aids = group.map((schedule) => schedule.aid); const aids = group.map((schedule) => Number(schedule.aid));
const filteredAids = await bulkGetVideosWithoutProcessingSchedules(client, aids); const filteredAids = await bulkGetVideosWithoutProcessingSchedules(client, aids);
if (filteredAids.length === 0) continue; if (filteredAids.length === 0) continue;
await bulkSetSnapshotStatus(client, filteredAids, "processing"); await bulkSetSnapshotStatus(client, filteredAids, "processing");
const dataMap: { [key: number]: number } = {}; const dataMap: { [key: number]: number } = {};
for (const schedule of group) { for (const schedule of group) {
dataMap[schedule.id] = schedule.aid; const id = Number(schedule.id);
dataMap[id] = Number(schedule.aid);
} }
await SnapshotQueue.add("bulkSnapshotVideo", { await SnapshotQueue.add("bulkSnapshotVideo", {
map: dataMap, map: dataMap,
}, { priority: 3 }); }, { priority: 3 });
} }
for (const schedule of schedules) { for (const schedule of schedules) {
if (await videoHasProcessingSchedule(client, schedule.aid)) { if (await videoHasProcessingSchedule(client, Number(schedule.aid))) {
return `ALREADY_PROCESSING`; return `ALREADY_PROCESSING`;
} }
let priority = 3; let priority = 3;