From 721f3d0b0fa457e0ebaca4cf15840175a4bf773d Mon Sep 17 00:00:00 2001 From: pinks Date: Mon, 11 Sep 2023 01:58:20 +0200 Subject: [PATCH] mark offline when 401 unauthorized --- tasks/processJobs.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tasks/processJobs.ts b/tasks/processJobs.ts index a2b05de..5df61bb 100644 --- a/tasks/processJobs.ts +++ b/tasks/processJobs.ts @@ -50,7 +50,11 @@ export async function processJobs(): Promise { } if ( err instanceof SdApiError && - (err.statusCode === 0 /* Network error */ || err.statusCode === 404) + ( + err.statusCode === 0 /* Network error */ || + err.statusCode === 404 || + err.statusCode === 401 + ) ) { runningWorkers.delete(worker.name); logger().warning( @@ -59,7 +63,7 @@ export async function processJobs(): Promise { } await job.delete().catch(() => undefined); if (!(err instanceof Grammy.GrammyError) || err.error_code !== 403 /* blocked bot */) { - await jobStore.create(job.value); + await jobStore.create(job.value); } }) .finally(() => busyWorkers.delete(worker.name));