Fix instant substractions that might have panicked

This commit is contained in:
Alex Auvolat
2022-09-29 15:53:54 +02:00
parent 497164d782
commit ad917ffd3f
4 changed files with 16 additions and 8 deletions
+3 -1
View File
@@ -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()