diff --git a/web/setup/publish-v2.js b/web/setup/publish-v2.js index 0e29fa2e8..b8cf56cc7 100644 --- a/web/setup/publish-v2.js +++ b/web/setup/publish-v2.js @@ -60,7 +60,7 @@ export function makeResumableUploadRequest( const uploader = new tus.Upload(file, { ...urlOptions, chunkSize: UPLOAD_CHUNK_SIZE_BYTE, - retryDelays: [0, 5000, 10000, 15000], + retryDelays: [0, 5000, 10000, 15000, 30000], parallelUploads: 1, storeFingerprintForResuming: false, removeFingerprintOnSuccess: true, @@ -73,21 +73,25 @@ export function makeResumableUploadRequest( window.store.dispatch(doUpdateUploadProgress({ guid, status: 'retry' })); const status = err.originalResponse ? err.originalResponse.getStatus() : 0; analytics.error(`tus: retry=${uploader._retryAttempt}, status=${status}`); - return !inStatusCategory(status, 400); + return !inStatusCategory(status, 400) || status === STATUS_CONFLICT || status === STATUS_LOCKED; }, onError: (err) => { const status = err.originalResponse ? err.originalResponse.getStatus() : 0; const errMsg = typeof err === 'string' ? err : err.message; - if (status === STATUS_CONFLICT || status === STATUS_LOCKED || errMsg === 'file currently locked') { + if (status === STATUS_CONFLICT) { window.store.dispatch(doUpdateUploadProgress({ guid, status: 'conflict' })); - // prettier-ignore - reject(new Error(`${status}: concurrent upload detected. Uploading the same file from multiple tabs or windows is not allowed.`)); + reject(new Error(`${status}: concurrent upload detected.`)); } else { + const errToLog = + status === STATUS_LOCKED || errMsg === 'file currently locked' + ? 'File is locked. Try resuming after waiting a few minutes' + : err; + window.store.dispatch(doUpdateUploadProgress({ guid, status: 'error' })); reject( // $FlowFixMe - flow's constructor for Error is incorrect. - new Error(err, { + new Error(errToLog, { cause: { url: uploader.url, status,