mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-22 02:12:40 +01:00
Client patcher now attempts assets multiple times, in case net sucks
This commit is contained in:
parent
fda13104ad
commit
c7ce750e92
@ -201,7 +201,20 @@ const processFile = async (asset) => {
|
||||
if (ONLY_CACHE_JS && !asset.endsWith(".js")) return [];
|
||||
|
||||
const url = `${BASE_URL}/assets/${asset}`;
|
||||
const res = await fetch(url, { agent });
|
||||
let res,
|
||||
tries = 5;
|
||||
do {
|
||||
try {
|
||||
res = await fetch(url, { agent });
|
||||
} catch (e) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
print(
|
||||
`Failed to fetch ${url} : ${e.message} ( tries remaining: ${tries} )`,
|
||||
false,
|
||||
);
|
||||
if (--tries <= 0) throw e;
|
||||
}
|
||||
} while (!res);
|
||||
if (res.status !== 200) {
|
||||
print(`${res.status} on ${asset}`, false);
|
||||
return [];
|
||||
|
Loading…
Reference in New Issue
Block a user