From 2dc9a4802279a0b7e742f8cf2e2cc85956bb7f83 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 20 Nov 2020 20:12:32 +0100 Subject: Fix reconciliation logic --- src/model/bucket_table.rs | 2 +- src/model/key_table.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/model/bucket_table.rs b/src/model/bucket_table.rs index adfb3370..35c0cc27 100644 --- a/src/model/bucket_table.rs +++ b/src/model/bucket_table.rs @@ -75,7 +75,7 @@ impl Entry for Bucket { } fn merge(&mut self, other: &Self) { - if other.timestamp < self.timestamp { + if other.timestamp > self.timestamp { *self = other.clone(); return; } diff --git a/src/model/key_table.rs b/src/model/key_table.rs index f912b11c..05b938ce 100644 --- a/src/model/key_table.rs +++ b/src/model/key_table.rs @@ -104,6 +104,11 @@ impl Entry for Key { } fn merge(&mut self, other: &Self) { + if other.name_timestamp > self.name_timestamp { + self.name_timestamp = other.name_timestamp; + self.name = other.name.clone(); + } + if other.deleted { self.deleted = true; } @@ -111,10 +116,6 @@ impl Entry for Key { self.authorized_buckets.clear(); return; } - if other.name_timestamp > self.name_timestamp { - self.name_timestamp = other.name_timestamp; - self.name = other.name.clone(); - } for ab in other.authorized_buckets.iter() { match self -- cgit v1.2.3