diff options
author | Alex Auvolat <alex@adnab.me> | 2021-03-12 14:51:17 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-03-12 14:51:17 +0100 |
commit | 1fea257291bdbf447f9918274ebf73848afb3a0c (patch) | |
tree | cb66077cd2a802c460936bc1a5d61be0e1ef14b5 /src/table | |
parent | 7fdaf7aef0c2aa8b38dbc7dac630f6f9baf8f0a4 (diff) | |
download | garage-1fea257291bdbf447f9918274ebf73848afb3a0c.tar.gz garage-1fea257291bdbf447f9918274ebf73848afb3a0c.zip |
Don't sync at beginning
Diffstat (limited to 'src/table')
-rw-r--r-- | src/table/sync.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/table/sync.rs b/src/table/sync.rs index dbfa0a9f..049a16ae 100644 --- a/src/table/sync.rs +++ b/src/table/sync.rs @@ -105,6 +105,7 @@ where mut must_exit: watch::Receiver<bool>, mut busy_rx: mpsc::UnboundedReceiver<bool>, ) -> Result<(), Error> { + let mut prev_ring: Arc<Ring> = self.aux.system.ring.borrow().clone(); let mut ring_recv: watch::Receiver<Arc<Ring>> = self.aux.system.ring.clone(); let mut nothing_to_do_since = Some(Instant::now()); @@ -117,9 +118,12 @@ where select! { new_ring_r = s_ring_recv => { - if new_ring_r.is_some() { - debug!("({}) Ring changed, adding full sync to syncer todo list", self.data.name); - self.add_full_sync(); + if let Some(new_ring) = new_ring_r { + if !Arc::ptr_eq(&new_ring, &prev_ring) { + debug!("({}) Ring changed, adding full sync to syncer todo list", self.data.name); + self.add_full_sync(); + prev_ring = new_ring; + } } } busy_opt = s_busy => { |