Uh oh!
There was an error while loading. Please reload this page.
Add retrying to the upload - #13
Conversation
robertbrignull
commented
May 1, 2020
Yes, thanks for spotting that. I completely forgot to mention that I made that change as part of this. I can easily back that change out if you'd prefer not to make it at this time. I believe that the will of @jhutchings1 and @joshhale was to now fail the action if there's a 500 when uploading. |
robertbrignull
commented
May 1, 2020
In fact, I will back this change out and we can make it at another time. |
robertbrignull
commented
May 1, 2020
Changed to only retry on 5xx errors, and I've changed the error message to include the status code. I've run some tests again so I'm happy with the testing of this. |
| ' seconds: (' + statusCode + ') ' + await res.readBody()); | ||
| // Sleep for the backoff period | ||
| await new Promise(r => setTimeout(r, backoffPeriods[attempt] * 1000)); | ||
| continue; |
There was a problem hiding this comment.
why do we need this continue here?
There was a problem hiding this comment.
To get to the next iteration of the loop. Technically it's not necessary as this is the last statement of the loop in this branch, but it doesn't hurt as far as I can see.
This should make the upload retry a few times and with a small amount of delay between attempts. Hopefully this will help get over very minor issues, though if there's a larger outage of github lasting more than a few seconds then it won't be able to help.
Merge / deployment checklist
upload_retrywhere everything is normalupload_retry_errorwhere all attempts failupload_retry_partial_errorwhere the first attempt fails