diff options
author | Alex Auvolat <alex@adnab.me> | 2021-03-15 20:09:44 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-03-15 20:09:44 +0100 |
commit | 4d4117f2b4eb69b63e2329f6e0b8929e6a8b5b31 (patch) | |
tree | 03da6808b6f0391293ab5a252d5efd1328acdefc /src/util | |
parent | 667e4e72a8e64a094d57ceeb6442cef08f1ef0e1 (diff) | |
download | garage-4d4117f2b4eb69b63e2329f6e0b8929e6a8b5b31.tar.gz garage-4d4117f2b4eb69b63e2329f6e0b8929e6a8b5b31.zip |
Refactor block resync loop; make workers infaillible
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/background.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/util/background.rs b/src/util/background.rs index 8081f157..3e600fdf 100644 --- a/src/util/background.rs +++ b/src/util/background.rs @@ -76,16 +76,13 @@ impl BackgroundRunner { pub fn spawn_worker<F, T>(&self, name: String, worker: F) where F: FnOnce(watch::Receiver<bool>) -> T + Send + 'static, - T: Future<Output = JobOutput> + Send + 'static, + T: Future<Output = ()> + Send + 'static, { let mut workers = self.workers.lock().unwrap(); let stop_signal = self.stop_signal.clone(); workers.push(tokio::spawn(async move { - if let Err(e) = worker(stop_signal).await { - error!("Worker stopped with error: {}, error: {}", name, e); - } else { - info!("Worker exited successfully: {}", name); - } + worker(stop_signal).await; + info!("Worker exited: {}", name); })); } |