diff options
author | Alex Auvolat <alex@adnab.me> | 2022-06-24 10:49:52 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-06-24 10:49:52 +0200 |
commit | 0837b3dacd994b35dbccbfefdd68be044eb4b5ac (patch) | |
tree | ce55e8978b852b69d9281bc170c20356e3c5dcfb /src/table | |
parent | 95ffba343f14d7274e08099b9aca5a85da2259ed (diff) | |
download | garage-0837b3dacd994b35dbccbfefdd68be044eb4b5ac.tar.gz garage-0837b3dacd994b35dbccbfefdd68be044eb4b5ac.zip |
Slightly improve blocking code, add info to resync worker
Diffstat (limited to 'src/table')
-rw-r--r-- | src/table/merkle.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/table/merkle.rs b/src/table/merkle.rs index 4c84933a..21186220 100644 --- a/src/table/merkle.rs +++ b/src/table/merkle.rs @@ -326,7 +326,18 @@ where &mut self, _must_exit: &mut watch::Receiver<bool>, ) -> Result<WorkerStatus, Error> { - self.0.updater_loop_iter() + let updater = self.0.clone(); + tokio::task::spawn_blocking(move || { + for _i in 0..100 { + let s = updater.updater_loop_iter(); + if !matches!(s, Ok(WorkerStatus::Busy)) { + return s; + } + } + Ok(WorkerStatus::Busy) + }) + .await + .unwrap() } async fn wait_for_work(&mut self, must_exit: &watch::Receiver<bool>) -> WorkerStatus { |