Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
Metrics
Onionoo
Commits
0f4c48ee
Commit
0f4c48ee
authored
Apr 25, 2022
by
Hiro
🏄
Browse files
Move logic when lastRestarted is set
parent
8ea27f30
Pipeline
#36787
failed with stage
in 1 minute and 24 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/torproject/metrics/onionoo/updater/NodeDetailsStatusUpdater.java
View file @
0f4c48ee
...
...
@@ -183,6 +183,26 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
Math
.
min
(
bandwidthBurst
,
observedBandwidth
));
detailsStatus
.
setDescPublished
(
descriptor
.
getPublishedMillis
());
detailsStatus
.
setLastRestarted
(
calculateLastRestartedMillis
(
descriptor
));
/**
* This is a bit of a hack. We read the uptime document to see if
* the relay/bridge had been on the network longer than what we thought.
* We should check instead why the firstSeenMillis attribute get set to
* 0 but it might be digging to deep into the onionoo cave.
**/
if
(
detailsStatus
.
getFirstSeenMillis
()
>
detailsStatus
.
getLastRestarted
())
{
UptimeStatus
uptimeStatus
=
this
.
documentStore
.
retrieve
(
UptimeStatus
.
class
,
true
,
fingerprint
);
if
(
uptimeStatus
!=
null
)
{
if
(
detailsStatus
.
isRelay
())
{
detailsStatus
.
setFirstSeenMillis
(
uptimeStatus
.
getRelayHistory
().
first
().
getStartMillis
()
);
}
}
}
detailsStatus
.
setBandwidthRate
(
bandwidthRate
);
detailsStatus
.
setBandwidthBurst
(
bandwidthBurst
);
detailsStatus
.
setObservedBandwidth
(
observedBandwidth
);
...
...
@@ -348,6 +368,27 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
descriptor
.
getBandwidthObserved
()));
detailsStatus
.
setDescPublished
(
descriptor
.
getPublishedMillis
());
detailsStatus
.
setLastRestarted
(
calculateLastRestartedMillis
(
descriptor
));
/**
* This is a bit of a hack. We read the uptime document to see if
* the relay/bridge had been on the network longer than what we thought.
* We should check instead why the firstSeenMillis attribute get set to
* 0 but it might be digging to deep into the onionoo cave.
**/
if
(
detailsStatus
.
getFirstSeenMillis
()
>
detailsStatus
.
getLastRestarted
())
{
UptimeStatus
uptimeStatus
=
this
.
documentStore
.
retrieve
(
UptimeStatus
.
class
,
true
,
fingerprint
);
if
(
uptimeStatus
!=
null
)
{
if
(!
detailsStatus
.
isRelay
())
{
detailsStatus
.
setFirstSeenMillis
(
uptimeStatus
.
getBridgeHistory
().
first
().
getStartMillis
()
);
}
}
}
detailsStatus
.
setAdvertisedBandwidth
(
advertisedBandwidth
);
long
overloadGeneralTimestamp
=
descriptor
.
getOverloadGeneralTimestamp
();
detailsStatus
.
setOverloadGeneralTimestamp
(
overloadGeneralTimestamp
);
...
...
@@ -578,29 +619,6 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
nodeStatus
.
getFirstSeenMillis
());
}
/**
* This is a bit of a hack. We read the uptime document to see if
* the relay/bridge had been on the network longer than what we thought.
* We should check instead why the firstSeenMillis attribute get set to
* 0 but it might be digging to deep into the onionoo cave.
**/
if
(
nodeStatus
.
getFirstSeenMillis
()
>
updatedNodeStatus
.
getLastRestarted
())
{
UptimeStatus
uptimeStatus
=
this
.
documentStore
.
retrieve
(
UptimeStatus
.
class
,
true
,
fingerprint
);
if
(
uptimeStatus
!=
null
)
{
if
(
updatedNodeStatus
.
isRelay
())
{
updatedNodeStatus
.
setFirstSeenMillis
(
uptimeStatus
.
getRelayHistory
().
first
().
getStartMillis
()
);
}
else
{
updatedNodeStatus
.
setFirstSeenMillis
(
uptimeStatus
.
getBridgeHistory
().
first
().
getStartMillis
()
);
}
}
}
updatedNodeStatus
.
setDeclaredFamily
(
nodeStatus
.
getDeclaredFamily
());
updatedNodeStatus
.
setEffectiveFamily
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment