aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-03-01 11:57:18 +0100
committerAlex Auvolat <alex@adnab.me>2022-03-14 11:51:37 +0100
commitf7e6f4616f79726674d0fa5e1b19b06cacdc3a2a (patch)
tree7ced15e67542f8c33334078c682c99f9be8ae207
parentdc5ec4ecf9df1664d79200dc9c41f86173ef7e07 (diff)
downloadgarage-f7e6f4616f79726674d0fa5e1b19b06cacdc3a2a.tar.gz
garage-f7e6f4616f79726674d0fa5e1b19b06cacdc3a2a.zip
Spawn a single resync worker
-rw-r--r--src/model/block.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/model/block.rs b/src/model/block.rs
index c7c178af..f0814eda 100644
--- a/src/model/block.rs
+++ b/src/model/block.rs
@@ -38,7 +38,6 @@ use crate::garage::Garage;
/// Size under which data will be stored inlined in database instead of as files
pub const INLINE_THRESHOLD: usize = 3072;
-pub const BACKGROUND_WORKERS: u64 = 1;
pub const BACKGROUND_TRANQUILITY: u32 = 2;
// Timeout for RPCs that read and write blocks to remote nodes
@@ -512,17 +511,14 @@ impl BlockManager {
// ---- Resync loop ----
pub fn spawn_background_worker(self: Arc<Self>) {
- // Launch n simultaneous workers for background resync loop preprocessing
- for i in 0..BACKGROUND_WORKERS {
- let bm2 = self.clone();
- let background = self.system.background.clone();
- tokio::spawn(async move {
- tokio::time::sleep(Duration::from_secs(10 * (i + 1))).await;
- background.spawn_worker(format!("block resync worker {}", i), move |must_exit| {
- bm2.resync_loop(must_exit)
- });
+ // Launch a background workers for background resync loop processing
+ let background = self.system.background.clone();
+ tokio::spawn(async move {
+ tokio::time::sleep(Duration::from_secs(10)).await;
+ background.spawn_worker("block resync worker".into(), move |must_exit| {
+ self.resync_loop(must_exit)
});
- }
+ });
}
fn put_to_resync(&self, hash: &Hash, delay: Duration) -> Result<(), Error> {