From fd74f496db898c91ba4e94cd7618ce46bcf431f4 Mon Sep 17 00:00:00 2001 From: ImJustChew Date: Fri, 26 Jul 2024 10:35:16 +0800 Subject: [PATCH] make custom abrot signal --- runners/update-courses.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runners/update-courses.ts b/runners/update-courses.ts index 0c52d696..bc0acbce 100644 --- a/runners/update-courses.ts +++ b/runners/update-courses.ts @@ -9,13 +9,15 @@ const job = schedule.scheduleJob('0 0 * * *', async () => { method: 'GET', headers: { 'Authorization': `Bearer ${process.env.CRON_SECRET}` - } + }, + signal: AbortSignal.timeout(5*60*1000) // 5 minutes }); const res2 = await fetch('http://localhost:8080/api/scrape-syllabus?semester=11310', { method: 'GET', headers: { 'Authorization': `Bearer ${process.env.CRON_SECRET}` - } + }, + signal: AbortSignal.timeout(20*60*1000) // 20 minutes }); const res3 = await fetch('http://localhost:8080/api/sync-algolia?semester=11310', { method: 'GET',