mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 09:58:26 +01:00
test this
This commit is contained in:
parent
f573d0ddeb
commit
f435cfe7fe
1 changed files with 20 additions and 8 deletions
|
@ -45,8 +45,20 @@ class PokeTubeDislikesAPIManager {
|
||||||
|
|
||||||
const { fetch } = await import("undici");
|
const { fetch } = await import("undici");
|
||||||
|
|
||||||
|
// why RYD? why... do i have to this lol?
|
||||||
|
for (let i = 0; i < 2; i++) {
|
||||||
|
try {
|
||||||
const engagement = await fetch(fallbackUrl).then((res) => res.json());
|
const engagement = await fetch(fallbackUrl).then((res) => res.json());
|
||||||
return engagement;
|
return engagement;
|
||||||
|
} catch (err) {
|
||||||
|
if (err.status === 503) {
|
||||||
|
// retry after a bit
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
} else {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue