Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
elandau committed Nov 14, 2018
1 parent 5ecbbf2 commit 3115ee4
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1677,11 +1677,10 @@ public long getLastSuccessfulRegistryFetchTimePeriod() {
@com.netflix.servo.annotations.Monitor(name = METRIC_REGISTRATION_PREFIX + "lastSuccessfulHeartbeatTimePeriod",
description = "How much time has passed from last successful heartbeat", type = DataSourceType.GAUGE)
private long getLastSuccessfulHeartbeatTimePeriodInternal() {
if (!clientConfig.shouldRegisterWithEureka() || isShutdown.get()) {
heartbeatStalenessMonitor.update(0);
return 0;
}
long delay = getLastSuccessfulHeartbeatTimePeriod();
final long delay = (!clientConfig.shouldRegisterWithEureka() || isShutdown.get())
? 0
: getLastSuccessfulHeartbeatTimePeriod();

heartbeatStalenessMonitor.update(computeStalenessMonitorDelay(delay));
return delay;
}
Expand All @@ -1690,11 +1689,10 @@ private long getLastSuccessfulHeartbeatTimePeriodInternal() {
@com.netflix.servo.annotations.Monitor(name = METRIC_REGISTRY_PREFIX + "lastSuccessfulRegistryFetchTimePeriod",
description = "How much time has passed from last successful local registry update", type = DataSourceType.GAUGE)
private long getLastSuccessfulRegistryFetchTimePeriodInternal() {
if (!clientConfig.shouldFetchRegistry() || isShutdown.get()) {
registryStalenessMonitor.update(0);
return 0;
}
long delay = getLastSuccessfulRegistryFetchTimePeriod();
final long delay = (!clientConfig.shouldFetchRegistry() || isShutdown.get())
? 0
: getLastSuccessfulRegistryFetchTimePeriod();

registryStalenessMonitor.update(computeStalenessMonitorDelay(delay));
return delay;
}
Expand Down

0 comments on commit 3115ee4

Please sign in to comment.