[pbs-devel] [PATCH proxmox-backup v3 3/7] api: admin: make s3 refresh handler sync
Christian Ebner
c.ebner at proxmox.com
Thu Nov 13 15:22:10 CET 2025
In preparation for properly awaiting active operations and locking
of the datastore context so it cannot be altered while doing the
refresh. This will mostly be sync code, therefore run this on its
own thread.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 1:
- not present in previous version, splitof for better readability and
reduced patch diff
src/api2/admin/datastore.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index 0e81533ce..25cf153d0 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -2673,17 +2673,17 @@ pub async fn unmount(store: String, rpcenv: &mut dyn RpcEnvironment) -> Result<V
},
)]
/// Refresh datastore contents from S3 to local cache store.
-pub async fn s3_refresh(store: String, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
+pub fn s3_refresh(store: String, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
let datastore = DataStore::lookup_datastore(&store, Some(Operation::Lookup))?;
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let to_stdout = rpcenv.env_type() == RpcEnvironmentType::CLI;
- let upid = WorkerTask::spawn(
+ let upid = WorkerTask::new_thread(
"s3-refresh",
Some(store),
auth_id.to_string(),
to_stdout,
- move |_worker| async move { datastore.s3_refresh().await },
+ move |_worker| proxmox_async::runtime::block_on(datastore.s3_refresh()),
)?;
Ok(json!(upid))
--
2.47.3
More information about the pbs-devel
mailing list