From 9e9ff26444cf7e4818c37c8881cb5d1f94e0a499 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Fri, 8 Aug 2025 03:24:55 +0700 Subject: [PATCH] feat: prevent crashing a schedule --- libraries/helpers/src/utils/concurrency.service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/helpers/src/utils/concurrency.service.ts b/libraries/helpers/src/utils/concurrency.service.ts index c23f61e1..bd35f469 100644 --- a/libraries/helpers/src/utils/concurrency.service.ts +++ b/libraries/helpers/src/utils/concurrency.service.ts @@ -31,7 +31,13 @@ export const concurrency = async ( await timer(300000); res(true as T); }), - func(), + new Promise(async (res) => { + try { + return res(await func()); + } catch (err) { + res(err as T); + } + }), ]); } );