api: wrap delete_group in spawn_blocking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-07-13 13:52:38 +02:00
parent a577d7d801
commit 6f67dc1197

View File

@ -273,14 +273,15 @@ pub fn list_groups(
},
)]
/// Delete backup group including all snapshots.
pub fn delete_group(
pub async fn delete_group(
store: String,
ns: Option<BackupNamespace>,
group: pbs_api_types::BackupGroup,
_info: &ApiMethod,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Value, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
tokio::task::spawn_blocking(move || {
let ns = ns.unwrap_or_default();
let datastore = check_privs_and_load_store(
@ -298,6 +299,8 @@ pub fn delete_group(
}
Ok(Value::Null)
})
.await?
}
#[api(