change hanged jobs to 2 minutes

This commit is contained in:
pinks 2023-09-11 01:58:51 +02:00
parent 721f3d0b0f
commit af9d31f75c
1 changed files with 2 additions and 2 deletions

View File

@ -14,9 +14,9 @@ export async function returnHangedJobs(): Promise<never> {
const jobs = await jobStore.getBy("status.type", "processing"); const jobs = await jobStore.getBy("status.type", "processing");
for (const job of jobs) { for (const job of jobs) {
if (job.value.status.type !== "processing") continue; if (job.value.status.type !== "processing") continue;
// if job wasn't updated for 1 minute, return it to the queue // if job wasn't updated for 2 minutes, return it to the queue
const timeSinceLastUpdateMs = Date.now() - job.value.status.updatedDate.getTime(); const timeSinceLastUpdateMs = Date.now() - job.value.status.updatedDate.getTime();
if (timeSinceLastUpdateMs > 60 * 1000) { if (timeSinceLastUpdateMs > 2 * 60 * 1000) {
await job.update({ status: { type: "waiting" } }); await job.update({ status: { type: "waiting" } });
logger().warning( logger().warning(
`Job for ${ `Job for ${