You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I noticed some strange behaviour of retry attempts when request is failed due to network error and idk if it's intended or not :) attemptCount is updated only when we receive response, but if we get network error or CORS error in my case, attemptCount is not changing and we keep spamming server with requests.
Shouldn't attempts control this case too?
/**
* Manage the whole upload by calling getChunk & sendChunk
* handle errors & retries and dispatch events
*/
private sendChunks() {
if (this.paused || this.offline || this.success) {
return;
}
this.getChunk()
.then(() => this.sendChunk()) <-------- maybe here?
.then((res) => {
this.attemptCount = this.attemptCount + 1; <-------- Shouldn't it be somewhere else?
if (SUCCESSFUL_CHUNK_UPLOAD_CODES.includes(res.statusCode)) {
.....
.catch((err) => { <-------- sendChunk failed and skipped attemptCount++
if (this.paused || this.offline) {
return;
}
// this type of error can happen after network disconnection on CORS setup
this.manageRetries();
});
The text was updated successfully, but these errors were encountered:
Hmm that's a good catch. Yes, probably makes sense to just move that increment into the block with sendChunk. Really I keep thinking we should move to tracking attempt count on individual chunks, but that's a much bigger change.
Hi!
I noticed some strange behaviour of retry attempts when request is failed due to network error and idk if it's intended or not :)
attemptCount
is updated only when we receive response, but if we get network error or CORS error in my case,attemptCount
is not changing and we keep spamming server with requests.Shouldn't
attempts
control this case too?The text was updated successfully, but these errors were encountered: