aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2023-06-13 12:51:16 +0000
committerAlex <alex@adnab.me>2023-06-13 12:51:16 +0000
commitfc2954893384d68b6ef0711f08ee1e64feb103ee (patch)
tree7a9593ddfe1dc4e930a2c66802f62f64fb0b980a
parent6aec73b6413b85260a273aea04ea64eb0a30b1c1 (diff)
parent1ea4937c8bd952a01a2e314f27080aac31353ef0 (diff)
downloadgarage-fc2954893384d68b6ef0711f08ee1e64feb103ee.tar.gz
garage-fc2954893384d68b6ef0711f08ee1e64feb103ee.zip
Merge pull request 'fix timestamps wrapping around in `garage block list-errors` (fix #584)' (#585) from fix-future-timestamps into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/585
-rw-r--r--src/garage/cli/util.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/garage/cli/util.rs b/src/garage/cli/util.rs
index 7d93efe3..1140cf22 100644
--- a/src/garage/cli/util.rs
+++ b/src/garage/cli/util.rs
@@ -373,13 +373,18 @@ pub fn print_block_error_list(el: Vec<BlockResyncErrorInfo>) {
let mut table = vec!["Hash\tRC\tErrors\tLast error\tNext try".into()];
for e in el {
+ let next_try = if e.next_try > now {
+ tf2.convert(Duration::from_millis(e.next_try - now))
+ } else {
+ "asap".to_string()
+ };
table.push(format!(
"{}\t{}\t{}\t{}\tin {}",
hex::encode(e.hash.as_slice()),
e.refcount,
e.error_count,
tf.convert(Duration::from_millis(now - e.last_try)),
- tf2.convert(Duration::from_millis(e.next_try - now))
+ next_try
));
}
format_table(table);