grpc-java
grpc-java copied to clipboard
OutlierDetection should use Ticker, not TimeProvider
TimeProvider provides wall time. That can move forward and backward as time is adjusted. OutlierDetection is measuring durations, so it should use a monotonic clock. We use Ticker (either Guava's or Deadline's, but generally Guava's) for that. FakeClock supports both for testing.
Doing a quick audit, this seems to be the only present incorrect use of TimeProvider.
I feel like I noticed this before, but I don't know why I didn't change it at the time. Maybe I had wanted to change the weird Long usage as well. (E.g., EPOCH = currentTimeNanos() - 1 and use EPOCH instead of null.)
CC @kannanjgithub