aboutsummaryrefslogtreecommitdiff
path: root/src/block/manager.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-09-02 17:18:13 +0200
committerAlex Auvolat <alex@adnab.me>2022-09-02 17:18:13 +0200
commit5d4b937a00882b9bf8b36f7430f3d1fe9db58903 (patch)
tree3cf20f72e046b31285712277d765387e772f3958 /src/block/manager.rs
parent5e8baa433d743a06ab3ee90f375f24c3c36fc236 (diff)
downloadgarage-5d4b937a00882b9bf8b36f7430f3d1fe9db58903.tar.gz
garage-5d4b937a00882b9bf8b36f7430f3d1fe9db58903.zip
Ability to have up to 4 concurrently working resync workers
Diffstat (limited to 'src/block/manager.rs')
-rw-r--r--src/block/manager.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/block/manager.rs b/src/block/manager.rs
index 62ef96b9..9240db25 100644
--- a/src/block/manager.rs
+++ b/src/block/manager.rs
@@ -125,13 +125,11 @@ impl BlockManager {
});
block_manager.endpoint.set_handler(block_manager.clone());
- // Spawn one resync worker
- let background = block_manager.system.background.clone();
- let worker = ResyncWorker::new(block_manager.clone());
- tokio::spawn(async move {
- tokio::time::sleep(Duration::from_secs(10)).await;
- background.spawn_worker(worker);
- });
+ // Spawn a bunch of resync workers
+ for index in 0..MAX_RESYNC_WORKERS {
+ let worker = ResyncWorker::new(index, block_manager.clone());
+ block_manager.system.background.spawn_worker(worker);
+ }
// Spawn scrub worker
let scrub_worker = ScrubWorker::new(block_manager.clone(), scrub_rx);