Notify: Re-enable delay but only for initial connection problem
We want to avoid the double `notify`, and also to confirm whether the SDK is timing out.
This commit is contained in:
parent
9bfa1a3577
commit
861aaf4cde
1 changed files with 4 additions and 4 deletions
|
@ -56,7 +56,7 @@ export function makeResumableUploadRequest(
|
||||||
window.store.dispatch(doUpdateUploadProgress({ params, progress: percentage }));
|
window.store.dispatch(doUpdateUploadProgress({ params, progress: percentage }));
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
let retries = 0;
|
let retries = 1;
|
||||||
|
|
||||||
function makeNotifyRequest() {
|
function makeNotifyRequest() {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
|
@ -70,9 +70,9 @@ export function makeResumableUploadRequest(
|
||||||
resolve(xhr);
|
resolve(xhr);
|
||||||
};
|
};
|
||||||
xhr.onerror = () => {
|
xhr.onerror = () => {
|
||||||
if (--retries > 0) {
|
if (retries > 0 && xhr.status === 0) {
|
||||||
// Auto-retry after 10s delay.
|
--retries;
|
||||||
setTimeout(() => makeNotifyRequest(), 10000);
|
setTimeout(() => makeNotifyRequest(), 10000); // Auto-retry after 10s delay.
|
||||||
} else {
|
} else {
|
||||||
window.store.dispatch(doUpdateUploadProgress({ params, status: 'error' }));
|
window.store.dispatch(doUpdateUploadProgress({ params, status: 'error' }));
|
||||||
reject(new Error(`There was a problem in the processing. Please retry. (${xhr.status})`));
|
reject(new Error(`There was a problem in the processing. Please retry. (${xhr.status})`));
|
||||||
|
|
Loading…
Add table
Reference in a new issue