From 1ea4937c8bd952a01a2e314f27080aac31353ef0 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 12 Jun 2023 20:07:33 +0200 Subject: [PATCH] fix timestamps wrapping around in `garage block list-errors` (fix #584) --- src/garage/cli/util.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) { 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);