diff --git a/src/main/startgg.ts b/src/main/startgg.ts index 9255edf..0a9e822 100644 --- a/src/main/startgg.ts +++ b/src/main/startgg.ts @@ -14,6 +14,27 @@ async function wrappedFetch( ): Promise { const response = await fetch(input, init); if (!response.ok) { + if ( + response.status === 500 || + response.status === 502 || + response.status === 503 || + response.status === 504 + ) { + return new Promise((resolve, reject) => { + setTimeout(async () => { + const retryResponse = await fetch(input, init); + if (!retryResponse.ok) { + reject( + new Error( + `${retryResponse.status} - ${retryResponse.statusText}`, + ), + ); + } else { + resolve(retryResponse); + } + }, 1000); + }); + } throw new Error(`${response.status} - ${response.statusText}`); } diff --git a/src/renderer/SetControls.tsx b/src/renderer/SetControls.tsx index 70c94b6..c80849c 100644 --- a/src/renderer/SetControls.tsx +++ b/src/renderer/SetControls.tsx @@ -390,11 +390,10 @@ export default function SetControls({ onClick={async () => { setReporting(true); try { - const promises = [reportSet(startggSet, set.state === 3)]; + await reportSet(startggSet, set.state === 3); if (reportSettings.alsoCopy) { - promises.push(copyReplays()); + await copyReplays(); } - await Promise.all(promises); if (reportSettings.alsoCopy && reportSettings.alsoDelete) { await deleteReplays(); }