mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-16 09:24:00 +00:00
log result
This commit is contained in:
parent
2f0ad53b60
commit
7dd857e00b
1 changed files with 3 additions and 1 deletions
|
@ -875,13 +875,15 @@ export async function waitUntil<T>(
|
||||||
delaySeconds = [0.2, 0.5, 1, 2, 3],
|
delaySeconds = [0.2, 0.5, 1, 2, 3],
|
||||||
) {
|
) {
|
||||||
let retry = 0;
|
let retry = 0;
|
||||||
|
let result;
|
||||||
while (retry++ < retries) {
|
while (retry++ < retries) {
|
||||||
const result = await fetcher();
|
result = await fetcher();
|
||||||
if (checker(result)) return result;
|
if (checker(result)) return result;
|
||||||
await delay(
|
await delay(
|
||||||
delaySeconds[Math.min(retry - 1, delaySeconds.length - 1)] * 1000,
|
delaySeconds[Math.min(retry - 1, delaySeconds.length - 1)] * 1000,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
console.error("result", result);
|
||||||
throw Error(
|
throw Error(
|
||||||
`Failed "${fetcher}": "${checker}" did not return true after ${retries} retries (delayed ${delaySeconds}s each)`,
|
`Failed "${fetcher}": "${checker}" did not return true after ${retries} retries (delayed ${delaySeconds}s each)`,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue