From d5004a15b45b805ecc5794630bb52072649f4f7b Mon Sep 17 00:00:00 2001 From: LightQuantum Date: Wed, 11 Oct 2023 23:49:47 -0700 Subject: [PATCH] fix(fetcher): entity too small on multipart upload --- rsync-fetcher/src/rsync/uploader.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rsync-fetcher/src/rsync/uploader.rs b/rsync-fetcher/src/rsync/uploader.rs index 69e4925..a7ea591 100644 --- a/rsync-fetcher/src/rsync/uploader.rs +++ b/rsync-fetcher/src/rsync/uploader.rs @@ -23,6 +23,8 @@ use crate::consts::UPLOAD_CONN; use crate::rsync::file_list::FileEntry; use crate::rsync::progress_display::ProgressDisplay; +const UPLOAD_CHUNK_SIZE: usize = 10 * 1024 * 1024; + pub struct Uploader { rx: flume::Receiver, file_list: Arc>, @@ -135,10 +137,11 @@ impl Uploader { let mut writer = content_disposition .map_or_else( - || self.s3.writer_with(&key), + || self.s3.writer_with(&key).buffer(UPLOAD_CHUNK_SIZE), |content_disposition| { self.s3 .writer_with(&key) + .buffer(UPLOAD_CHUNK_SIZE) .content_disposition(&content_disposition) }, )