Skip to content

Commit

Permalink
Don't treat failure to send as an error
Browse files Browse the repository at this point in the history
If the file reader task fails to send a chunk to an upload task, we know
this is because that task has either returned due to an error or
panicked. In either case this isn't an error for the reader, which
should return early as the overall request will fail.
  • Loading branch information
wfchandler committed Jan 30, 2025
1 parent e3ca199 commit 1448dcd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sdk/src/extras/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,14 @@ pub mod types {
if !chunk.iter().all(|x| *x == 0) {
let encoded = base64::engine::general_purpose::STANDARD.encode(&chunk[0..n]);

if let Err(e) = senders[i % self.upload_thread_ct]
if senders[i % self.upload_thread_ct]
.send((offset, encoded, n as u64))
.await
.is_err()
{
break Err(DiskImportError::other(format!(
"sending chunk to thread failed: {e}"
)));
// Failure to send indicates that the upload task exited early
// due to an error on its end. We will return that error below.
break Ok(());
}
} else {
// Bump the progress bar here to make it consistent
Expand Down

0 comments on commit 1448dcd

Please sign in to comment.