aboutsummaryrefslogtreecommitdiff
path: root/src/block
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2023-05-11 09:33:03 +0000
committerAlex <alex@adnab.me>2023-05-11 09:33:03 +0000
commit375270afd19a8ce2aa3ff99bd0fc3ccab638c223 (patch)
tree362189dcfde317ef4dd0613ab621684469c17168 /src/block
parentb925f53dc3b0bae77aa3f73e581faace2eb3b21a (diff)
parentc783194e8b8c3263fad579a85ea07d62e63b16be (diff)
downloadgarage-375270afd19a8ce2aa3ff99bd0fc3ccab638c223.tar.gz
garage-375270afd19a8ce2aa3ff99bd0fc3ccab638c223.zip
Merge pull request '*: apply clippy recommendations.' (#570) from jpds/garage:clippy-fixes into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/570
Diffstat (limited to 'src/block')
-rw-r--r--src/block/repair.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/block/repair.rs b/src/block/repair.rs
index c89484d9..71093d69 100644
--- a/src/block/repair.rs
+++ b/src/block/repair.rs
@@ -220,14 +220,12 @@ fn randomize_next_scrub_run_time(timestamp: u64) -> u64 {
// Take SCRUB_INTERVAL and mix in a random interval of 10 days to attempt to
// balance scrub load across different cluster nodes.
- let next_run_timestamp = timestamp
+ timestamp
+ SCRUB_INTERVAL
.saturating_add(Duration::from_secs(
rand::thread_rng().gen_range(0..3600 * 24 * 10),
))
- .as_millis() as u64;
-
- next_run_timestamp
+ .as_millis() as u64
}
impl Default for ScrubWorkerPersisted {
@@ -241,18 +239,14 @@ impl Default for ScrubWorkerPersisted {
}
}
+#[derive(Default)]
enum ScrubWorkerState {
Running(BlockStoreIterator),
Paused(BlockStoreIterator, u64), // u64 = time when to resume scrub
+ #[default]
Finished,
}
-impl Default for ScrubWorkerState {
- fn default() -> Self {
- ScrubWorkerState::Finished
- }
-}
-
#[derive(Debug)]
pub enum ScrubWorkerCommand {
Start,