update: termination condition to time-based in classifyVideosWorker
This commit is contained in:
parent
1a20d5afe0
commit
2c83b79881
@ -51,14 +51,14 @@ export const classifyVideosWorker = async () => {
|
||||
const videos = await getUnlabelledVideos(sql);
|
||||
logger.log(`Found ${videos.length} unlabelled videos`);
|
||||
|
||||
let i = 0;
|
||||
const startTime = new Date().getTime();
|
||||
for (const aid of videos) {
|
||||
if (i > 200) {
|
||||
const now = new Date().getTime();
|
||||
if (now - startTime > 4.2 * MINUTE) {
|
||||
await lockManager.releaseLock("classifyVideos");
|
||||
return 10000 + i;
|
||||
return 1;
|
||||
}
|
||||
await ClassifyVideoQueue.add("classifyVideo", { aid: Number(aid) });
|
||||
i++;
|
||||
}
|
||||
await lockManager.releaseLock("classifyVideos");
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user