FEATURE: Local chunked uppy backup uploads with a new uploader plugin (#14894)

This takes the uppy chunking algorithm and combines it with some
form submission from resumable.js for parity with the current
backup controller to make local backup uploads work with uppy.
We can then use this to replace the resumable-upload component
and the resumable.js library from our codebase, once stable.

This is disabled by default, so people using local backups will not
be affected. The enable_experimental_backup_uploader site setting
must be enabled for this to work.
This commit is contained in:
Martin Brennan
2021-11-23 08:45:42 +10:00
committed by GitHub
parent 377c8d9c8b
commit 49c49e8ae0
13 changed files with 688 additions and 49 deletions

View File

@ -180,13 +180,11 @@ class Admin::BackupsController < Admin::AdminController
current_chunk_size = params.fetch(:resumableCurrentChunkSize).to_i
previous_chunk_number = chunk_number - 1
# path to chunk file
chunk = BackupRestore::LocalBackupStore.chunk_path(identifier, filename, chunk_number)
# upload chunk
HandleChunkUpload.upload_chunk(chunk, file: file)
uploaded_file_size = previous_chunk_number * chunk_size
# when all chunks are uploaded
uploaded_file_size = previous_chunk_number * chunk_size
if uploaded_file_size + current_chunk_size >= total_size
# merge all the chunks in a background thread
Jobs.enqueue_in(5.seconds, :backup_chunks_merger, filename: filename, identifier: identifier, chunks: chunk_number)