Skip to content

Commit

Permalink
Forgot to update logical dns logic
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Jin Xuan <[email protected]>
  • Loading branch information
Stevenjin8 committed Nov 5, 2024
1 parent 56e4def commit 0062734
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/extensions/clusters/logical_dns/logical_dns_cluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 0062734

Please sign in to comment.