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/block/manager.rs | |
parent | 95ffba343f14d7274e08099b9aca5a85da2259ed (diff) | |
download | garage-0837b3dacd994b35dbccbfefdd68be044eb4b5ac.tar.gz garage-0837b3dacd994b35dbccbfefdd68be044eb4b5ac.zip |
Slightly improve blocking code, add info to resync worker
Diffstat (limited to 'src/block/manager.rs')
-rw-r--r-- | src/block/manager.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/block/manager.rs b/src/block/manager.rs index db73ecbc..4a595cc8 100644 --- a/src/block/manager.rs +++ b/src/block/manager.rs @@ -728,6 +728,23 @@ impl Worker for ResyncWorker { "Block resync worker".into() } + fn info(&self) -> Option<String> { + let mut ret = vec![]; + let qlen = self.manager.resync_queue_len().unwrap_or(0); + let elen = self.manager.resync_errors_len().unwrap_or(0); + if qlen > 0 { + ret.push(format!("{} blocks in queue", qlen)); + } + if elen > 0 { + ret.push(format!("{} blocks in error state", elen)); + } + if ret.len() > 0 { + Some(ret.join(", ")) + } else { + None + } + } + async fn work( &mut self, _must_exit: &mut watch::Receiver<bool>, |