From a512f2aba3ebae5341d6188ee4cebf1e4f9da315 Mon Sep 17 00:00:00 2001 From: Will Chandler Date: Mon, 2 Dec 2024 17:03:11 -0500 Subject: [PATCH] Don't cancel uploads run without control 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 --- sdk/src/extras/disk.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdk/src/extras/disk.rs b/sdk/src/extras/disk.rs index b7f9ac2d..54c16e20 100644 --- a/sdk/src/extras/disk.rs +++ b/sdk/src/extras/disk.rs @@ -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}; @@ -107,7 +108,12 @@ pub mod builder { impl Future> + 'a, 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