Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change re-upload behaviour of storage requests #28

Merged
merged 4 commits into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/resources/assets/js/createContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {LoaderMixin, handleErrorResponse, FileBrowserComponent} from './import';
import {sizeForHumans} from './utils';
// Number of times a file upload is retried.
const RETRY_UPLOAD = 2;
const RETRY_UPLOAD = 3;
export default {
mixins: [LoaderMixin],
Expand Down Expand Up @@ -428,9 +428,12 @@ export default {
// Try uploading again on server error until number of retries is
// reached.
if (e.status >= 500 && retryCount < RETRY_UPLOAD) {
return this.uploadBlob(blob, prefix, chunkIndex, totalChunks, retryCount + 1);
// Add delay to prevent failing uploads due to e.g. BIIGLE instance updates or
// short moments of unavailability.
return new Vue.Promise((resolve) => {
setTimeout(() => resolve(this.uploadBlob(blob, prefix, chunkIndex, totalChunks, retryCount + 1)), 5000);
});
}
throw e;
});
},
Expand Down