Commit 8ea27f30 authored by Hiro's avatar Hiro 🏄
Browse files

Fix last seen / last restarted bug

parent 778feb39
Pipeline #36782 passed with stage
in 2 minutes and 21 seconds
......@@ -226,6 +226,18 @@ public class NodeStatus extends Document {
return this.lastSeenMillis;
}
private String lastRestarted;
public void setLastRestarted(Long lastRestarted) {
this.lastRestarted = null == lastRestarted ? null
: DateTimeHelper.format(lastRestarted);
}
public Long getLastRestarted() {
return this.lastRestarted == null ? null :
DateTimeHelper.parse(this.lastRestarted);
}
private int orPort;
public void setOrPort(int orPort) {
......
......@@ -560,6 +560,7 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
updatedNodeStatus.setOrAddressesAndPorts(orAddressesAndPorts);
updatedNodeStatus.setLastSeenMillis(
nodeStatus.getLastSeenMillis());
updatedNodeStatus.setLastRestarted(nodeStatus.getLastRestarted());
updatedNodeStatus.setOrPort(orPort);
updatedNodeStatus.setDirPort(dirPort);
updatedNodeStatus.setRelayFlags(nodeStatus.getRelayFlags());
......@@ -584,7 +585,7 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
* 0 but it might be digging to deep into the onionoo cave.
**/
if (nodeStatus.getFirstSeenMillis()
> updatedNodeStatus.getLastSeenMillis()) {
> updatedNodeStatus.getLastRestarted()) {
UptimeStatus uptimeStatus = this.documentStore.retrieve(
UptimeStatus.class, true, fingerprint);
if (uptimeStatus != null) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment