aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/system.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-09-29 15:53:54 +0200
committerAlex Auvolat <alex@adnab.me>2022-09-29 15:53:54 +0200
commitad917ffd3f76316e48b89ff17e2f8a600a269481 (patch)
tree4411b84a2021eda2e98e38c4549ba00dc71dcef6 /src/rpc/system.rs
parent497164d78253fa1dd3cdbfc8a5267edaab4040f3 (diff)
downloadgarage-ad917ffd3f76316e48b89ff17e2f8a600a269481.tar.gz
garage-ad917ffd3f76316e48b89ff17e2f8a600a269481.zip
Fix instant substractions that might have panickedfix-time
Diffstat (limited to 'src/rpc/system.rs')
-rw-r--r--src/rpc/system.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rpc/system.rs b/src/rpc/system.rs
index f8121193..9e0bfa11 100644
--- a/src/rpc/system.rs
+++ b/src/rpc/system.rs
@@ -369,7 +369,9 @@ impl System {
id: n.id.into(),
addr: n.addr,
is_up: n.is_up(),
- last_seen_secs_ago: n.last_seen.map(|t| (Instant::now() - t).as_secs()),
+ last_seen_secs_ago: n
+ .last_seen
+ .map(|t| (Instant::now().saturating_duration_since(t)).as_secs()),
status: node_status
.get(&n.id.into())
.cloned()