diff --git a/source/extensions/clusters/logical_dns/logical_dns_cluster.cc b/source/extensions/clusters/logical_dns/logical_dns_cluster.cc index 606061c7aea4f..5151d8b1ec4cf 100644 --- a/source/extensions/clusters/logical_dns/logical_dns_cluster.cc +++ b/source/extensions/clusters/logical_dns/logical_dns_cluster.cc @@ -152,14 +152,14 @@ void LogicalDnsCluster::startResolve() { final_refresh_rate = addrinfo.ttl_; } if (dns_jitter_ms_.count() != 0) { - // Note that `parent_.random_.random()` returns a uint64 while - // `parent_.dns_jitter_ms_.count()` returns a signed long that gets cast into a uint64. + // Note that `random_.random()` returns a uint64 while + // `dns_jitter_ms_.count()` returns a signed long that gets cast into a uint64. // Thus, the modulo of the two will be a positive as long as - // `parent_dns_jitter_ms_.count()` is positive. + // `dns_jitter_ms_.count()` is positive. // It is important that this be positive, otherwise `final_refresh_rate` could be // negative causing Envoy to crash. final_refresh_rate += - std::chrono::abs(std::chrono::milliseconds(random_.random()) % dns_jitter_ms_); + std::chrono::milliseconds(random_.random() % dns_jitter_ms_.count()); } ENVOY_LOG(debug, "DNS refresh rate reset for {}, refresh rate {} ms", dns_address_, final_refresh_rate.count());