From b70fe09d17104e7ba931bf388a1d964aaceea27d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 5 Apr 2022 11:13:13 +0200 Subject: [PATCH] fix: Remove asyncUntil --- src/lib/common.ts | 14 -------------- src/lib/queues/index.ts | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/lib/common.ts b/src/lib/common.ts index d6b36b209..680e35208 100644 --- a/src/lib/common.ts +++ b/src/lib/common.ts @@ -46,20 +46,6 @@ const customConfig: Config = { export const version = currentVersion; export const asyncExecShell = util.promisify(child.exec); export const asyncSleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay)); -export const asyncUntil = (condition, delay, maxIterations) => { - return new Promise(async (resolve, reject) => { - let iterations = 0; - while (!condition()) { - if (maxIterations && iterations >= maxIterations) { - reject(new Error('Max iterations reached.')); - return; - } - await asyncSleep(delay); - iterations++; - } - resolve(); - }); -}; export const sentry = Sentry; diff --git a/src/lib/queues/index.ts b/src/lib/queues/index.ts index c8646c3a1..736d76789 100644 --- a/src/lib/queues/index.ts +++ b/src/lib/queues/index.ts @@ -11,7 +11,7 @@ import proxy from './proxy'; import ssl from './ssl'; import sslrenewal from './sslrenewal'; -import { asyncExecShell, asyncUntil, saveBuildLog } from '$lib/common'; +import { asyncExecShell, saveBuildLog } from '$lib/common'; let { Queue, Worker } = Bullmq; let redisHost = 'localhost';