move 'wait_for_local_worker' from client to server
this just made no sense in the client Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
@ -804,3 +804,23 @@ impl pbs_datastore::task::TaskState for WorkerTask {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Wait for a locally spanned worker task
|
||||
///
|
||||
/// Note: local workers should print logs to stdout, so there is no
|
||||
/// need to fetch/display logs. We just wait for the worker to finish.
|
||||
pub async fn wait_for_local_worker(upid_str: &str) -> Result<(), Error> {
|
||||
|
||||
let upid: UPID = upid_str.parse()?;
|
||||
|
||||
let sleep_duration = core::time::Duration::new(0, 100_000_000);
|
||||
|
||||
loop {
|
||||
if worker_is_active_local(&upid) {
|
||||
tokio::time::sleep(sleep_duration).await;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user