Skip to content
Prev Previous commit
Next Next commit
11622 : OutlierDetection should use Ticker, not TimeProvider
  • Loading branch information
vimanikag committed Jun 4, 2025
commit c831f1e86995cbe45b7f1d7986ef1a94e32b03f7
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ private synchronized void fail(Status status) {
}

private synchronized void success() {
long currentTickerTimeNanos = ticker.read();
if (!done) {
done = true;
executor.execute(() -> callback.onSuccess(currentTickerTimeNanos - startTimeNanos));
executor.execute(() -> callback.onSuccess(ticker.read() - startTimeNanos));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public void updateWindow() throws Http2Exception {
setPinging(false);

long currentTickerTimeNanos = ticker.read();
long elapsedTime = (currentTickerTimeNanos - lastPingTime);
long elapsedTime = Math.max(0L,(currentTickerTimeNanos - lastPingTime));
if (elapsedTime == 0) {
elapsedTime = 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public Status acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
initialDelayNanos = config.intervalNanos;
} else {
long currentTickerTimeNanos = ticker.read();
long elapsedTimeNanos = currentTickerTimeNanos - detectionTimerStartNanos;
long elapsedTimeNanos = Math.max(0L,(currentTickerTimeNanos - detectionTimerStartNanos));
// If a timer has started earlier we cancel it and use the difference between the start
// time and now as the interval.
initialDelayNanos = Math.max(0L,
Expand Down