diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-01-16 22:39:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-16 22:39:35 +0100 |
commit | a85912b0d6d2ee68aa35794fbb51c5358768c092 (patch) | |
tree | af0dde21359576102ab8dcf8a1dc3342f67bb71c /app/javascript/flavours/glitch | |
parent | 07cb948f39464b11959fc506b673a90d9524e519 (diff) | |
parent | 278bd61d6f507e56350e7f14caaeaa954700ecd8 (diff) |
Merge pull request #1659 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch')
-rw-r--r-- | app/javascript/flavours/glitch/actions/compose.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index 9af8b6d20..261c72b2a 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -286,12 +286,15 @@ export function uploadCompose(files) { if (status === 200) { dispatch(uploadComposeSuccess(data, f)); } else if (status === 202) { + let tryCount = 1; const poll = () => { api(getState).get(`/api/v1/media/${data.id}`).then(response => { if (response.status === 200) { dispatch(uploadComposeSuccess(response.data, f)); } else if (response.status === 206) { - setTimeout(() => poll(), 1000); + let retryAfter = (Math.log2(tryCount) || 1) * 1000; + tryCount += 1; + setTimeout(() => poll(), retryAfter); } }).catch(error => dispatch(uploadComposeFail(error))); }; |