fix retry logic

This commit is contained in:
2020-01-21 17:13:18 +01:00
parent 8bff81ce6c
commit 303cf3f8f8

View File

@@ -134,6 +134,9 @@ class UploadManager {
if (typeof(job.onFinished) === "function") {
job.onFinished(resp.id);
}
// Finish the upload job
um.finishUpload();
} else if (xhr.status >= 400) {
// Request failed
console.log("Upload error. status: " + xhr.status + " response: " + xhr.response);
@@ -144,6 +147,9 @@ class UploadManager {
job.tries++;
um.uploadQueue.push(job);
}
// Sleep the upload thread for 5 seconds
window.setTimeout(() => { um.finishUpload(); }, 5000);
} else {
// Request did not arrive
if (job.tries === 3) { // Upload failed
@@ -154,10 +160,10 @@ class UploadManager {
job.tries++;
um.uploadQueue.push(job);
}
}
// Finish the upload job
um.finishUpload();
// Sleep the upload thread for 5 seconds
window.setTimeout(() => { um.finishUpload(); }, 5000);
}
};
xhr.send(form);
}