Skip to content

Commit

Permalink
Don't cancel uploads run without control
Browse files Browse the repository at this point in the history
Currently `execute` will drop the import handle immediately,
inadvertently canceling the request.

Leak the handle, which will never be used, so that we allow the request
to run to completion.

Closes #930
  • Loading branch information
wfchandler committed Dec 2, 2024
1 parent eae1dbd commit a512f2a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sdk/src/extras/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub mod builder {
use crate::{Client, Error};

use std::future::Future;
use std::mem;
use std::sync::atomic::{AtomicBool, AtomicU64};
use std::sync::Arc;
use tokio::sync::{oneshot, watch};
Expand Down Expand Up @@ -107,7 +108,12 @@ pub mod builder {
impl Future<Output = Result<(), DiskImportError>> + 'a,
Error<crate::types::Error>,
> {
Ok(self.execute_with_control()?.0)
let (fut, handle) = self.execute_with_control()?;

// Leak the handle so we don't cancel the request by dropping it.
mem::forget(handle);

Ok(fut)
}

/// Return a `Future` for the disk creation and a `DiskImportHandle` which
Expand Down

0 comments on commit a512f2a

Please sign in to comment.