]> git.proxmox.com Git - proxmox-backup.git/commitdiff
followup: server/state: rename task_count to internal_task_count
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 24 Jul 2020 10:11:33 +0000 (12:11 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 24 Jul 2020 10:11:39 +0000 (12:11 +0200)
so that the relation with spawn_internal_task is made more clear

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/server/state.rs

index d0732434dbdb8d29d20abdedcf617ffac08d9069..178c8ac64fdf409fd10f06477575a35ca2da1f1e 100644 (file)
@@ -19,7 +19,7 @@ pub struct ServerState {
     pub shutdown_listeners: BroadcastData<()>,
     pub last_worker_listeners: BroadcastData<()>,
     pub worker_count: usize,
-    pub task_count: usize,
+    pub internal_task_count: usize,
     pub reload_request: bool,
 }
 
@@ -29,7 +29,7 @@ lazy_static! {
         shutdown_listeners: BroadcastData::new(),
         last_worker_listeners: BroadcastData::new(),
         worker_count: 0,
-        task_count: 0,
+        internal_task_count: 0,
         reload_request: false,
     });
 }
@@ -111,7 +111,7 @@ pub fn set_worker_count(count: usize) {
 pub fn check_last_worker() {
     let mut data = SERVER_STATE.lock().unwrap();
 
-    if !(data.mode == ServerMode::Shutdown && data.worker_count == 0 && data.task_count == 0) { return; }
+    if !(data.mode == ServerMode::Shutdown && data.worker_count == 0 && data.internal_task_count == 0) { return; }
 
     data.last_worker_listeners.notify_listeners(Ok(()));
 }
@@ -125,15 +125,15 @@ where
     T::Output: Send + 'static,
 {
     let mut data = SERVER_STATE.lock().unwrap();
-    data.task_count += 1;
+    data.internal_task_count += 1;
 
     tokio::spawn(async move {
         let _ = tokio::spawn(task).await; // ignore errors
 
         { // drop mutex
             let mut data = SERVER_STATE.lock().unwrap();
-            if data.task_count > 0 {
-                data.task_count -= 1;
+            if data.internal_task_count > 0 {
+                data.internal_task_count -= 1;
             }
         }