refactor(core): Unify error reporters in core and task runners (#12168)

Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
This commit is contained in:
Iván Ovejero
2024-12-13 17:34:37 +01:00
committed by GitHub
parent d937e5abe8
commit 120499291d
7 changed files with 33 additions and 175 deletions

View File

@@ -8,7 +8,7 @@
*/
export const retryUntil = async (
assertion: () => Promise<void> | void,
{ interval = 20, timeout = 1000 } = {},
{ intervalMs = 200, timeoutMs = 5000 } = {},
) => {
return await new Promise((resolve, reject) => {
const startTime = Date.now();
@@ -18,13 +18,13 @@ export const retryUntil = async (
try {
resolve(await assertion());
} catch (error) {
if (Date.now() - startTime > timeout) {
if (Date.now() - startTime > timeoutMs) {
reject(error);
} else {
tryAgain();
}
}
}, interval);
}, intervalMs);
};
tryAgain();