diff options
author | Alex Auvolat <alex@adnab.me> | 2022-07-08 09:55:27 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-07-08 09:55:27 +0200 |
commit | 0200eae679cbb04f846f173a9b7b256ed697f500 (patch) | |
tree | 4f754a0d9d5df525cd3582097824060c63cf0dbb | |
parent | 5ee9cb7768f27182325ae9b943f39c12e69a95d6 (diff) | |
download | garage-0200eae679cbb04f846f173a9b7b256ed697f500.tar.gz garage-0200eae679cbb04f846f173a9b7b256ed697f500.zip |
cleanup
-rw-r--r-- | src/block/manager.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/block/manager.rs b/src/block/manager.rs index 36166ae3..17d4a72d 100644 --- a/src/block/manager.rs +++ b/src/block/manager.rs @@ -494,11 +494,7 @@ impl BlockManager { fn spawn_background_workers(self: Arc<Self>) { // Launch a background workers for background resync loop processing let background = self.system.background.clone(); - let worker = ResyncWorker { - manager: self.clone(), - tranquilizer: Tranquilizer::new(30), - next_delay: Duration::from_secs(10), - }; + let worker = ResyncWorker::new(self.clone()); tokio::spawn(async move { tokio::time::sleep(Duration::from_secs(10)).await; background.spawn_worker(worker); @@ -744,6 +740,16 @@ struct ResyncWorker { next_delay: Duration, } +impl ResyncWorker { + fn new(manager: Arc<BlockManager>) -> Self { + Self { + manager, + tranquilizer: Tranquilizer::new(30), + next_delay: Duration::from_secs(10), + } + } +} + #[async_trait] impl Worker for ResyncWorker { fn name(&self) -> String { |