diff options
Diffstat (limited to 'src/remake')
| -rw-r--r-- | src/remake/catchup.rs | 19 | ||||
| -rw-r--r-- | src/remake/switch.rs | 6 | ||||
| -rw-r--r-- | src/remake/vote.rs | 8 |
3 files changed, 17 insertions, 16 deletions
diff --git a/src/remake/catchup.rs b/src/remake/catchup.rs index b00a210..0be7dfd 100644 --- a/src/remake/catchup.rs +++ b/src/remake/catchup.rs @@ -67,14 +67,14 @@ pub(super) async fn check<H: Host>(host: &H) { } if host.initial_sync_done() { finish(host).await; - } else if started.elapsed() > timeout { - if let Some(rejoin) = host.remake().take_rejoin() { - let reason = format!( - "no peer on {target} completed a sync within {}s", - timeout.as_secs() - ); - abandon(host, rejoin, reason).await; - } + } else if started.elapsed() > timeout + && let Some(rejoin) = host.remake().take_rejoin() + { + let reason = format!( + "no peer on {target} completed a sync within {}s", + timeout.as_secs() + ); + abandon(host, rejoin, reason).await; } return; } @@ -253,6 +253,9 @@ enum Plan { }, } +// Every variant holds a whole document; one value lives for one step of a rejoin, so +// boxing would only add an indirection. +#[allow(clippy::large_enum_variant)] enum Prepared { /// Caught up with someone, but not with the target epoch yet: keep waiting. NotYet(AutoCommit), diff --git a/src/remake/switch.rs b/src/remake/switch.rs index 903baea..ea56de6 100644 --- a/src/remake/switch.rs +++ b/src/remake/switch.rs @@ -232,10 +232,8 @@ async fn switch<H: Host>( let mut doc = snapshot.doc.with_actor(actor); // Keep this remake's record visible in the new epoch, for its history. - if carry_record { - if let Err(error) = store::copy_path(©, &mut doc, &record_path) { - warn!(error = %error, "Could not carry the remake record into the new epoch"); - } + if carry_record && let Err(error) = store::copy_path(©, &mut doc, &record_path) { + warn!(error = %error, "Could not carry the remake record into the new epoch"); } let heads = copy.get_heads(); diff --git a/src/remake/vote.rs b/src/remake/vote.rs index 9bc8890..d5b167f 100644 --- a/src/remake/vote.rs +++ b/src/remake/vote.rs @@ -272,10 +272,10 @@ pub(super) async fn cast<H: Host>(host: &H) { return; }; // Only with the content in hand: a committed remake must have it on a majority. - if let Some(reference) = &content { - if content::available_or_fetch(host, reference).is_none() { - return; - } + if let Some(reference) = &content + && content::available_or_fetch(host, reference).is_none() + { + return; } // Spread over half a keepalive interval, so later voters see the earlier votes // (the worker checks every second). |
