]> git.proxmox.com Git - proxmox-backup.git/commitdiff
move 'wait_for_local_worker' from client to server
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 19 Jul 2021 08:44:40 +0000 (10:44 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 19 Jul 2021 08:44:44 +0000 (10:44 +0200)
this just made no sense in the client

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/bin/proxmox-backup-manager.rs
src/client/remote_chunk_reader.rs
src/client/task_log.rs
src/server/worker_task.rs

index 228d7ed13093e98aefc614dd588eb08511820d38..5c70d8c7816e05312ab03c44a9d39b1b1093402d 100644 (file)
@@ -12,6 +12,7 @@ use proxmox_backup::tools;
 use proxmox_backup::config;
 use proxmox_backup::api2::{self, types::* };
 use proxmox_backup::client::*;
+use proxmox_backup::server::wait_for_local_worker;
 
 mod proxmox_backup_manager;
 use proxmox_backup_manager::*;
index 78c79af26e0a0fda5e48ed92b5fbc0025a80d3d4..61b6fb052232142508e93d5e8634d2e24519b3f7 100644 (file)
@@ -8,10 +8,10 @@ use anyhow::{bail, Error};
 use pbs_datastore::{CryptConfig, CryptMode};
 use pbs_datastore::data_blob::DataBlob;
 use pbs_datastore::read_chunk::ReadChunk;
+use pbs_datastore::read_chunk::AsyncReadChunk;
 use pbs_runtime::block_on;
 
 use super::BackupReader;
-use crate::backup::AsyncReadChunk;
 
 /// Read chunks from remote host using ``BackupReader``
 #[derive(Clone)]
index 6350e83afd47905f307c1e05ad277956c9cd446c..1d1af14168437cbaa2858fd936dd9dec69704607 100644 (file)
@@ -10,7 +10,6 @@ use proxmox::api::cli::format_and_print_result;
 use pbs_tools::percent_encoding::percent_encode_component;
 
 use super::HttpClient;
-use crate::server::{UPID, worker_is_active_local};
 
 /// Display task log on console
 ///
@@ -116,23 +115,3 @@ pub async fn view_task_result(
 
     Ok(())
 }
-
-/// 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(())
-}
index 135784466df2a929ffcd6aada893d809e04fd29a..20518ece42d7c4b1a553a28d763c39e2e3239d44 100644 (file)
@@ -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(())
+}