Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Beyad <abeyad@google.com>
  • Loading branch information
abeyad committed Jan 18, 2024
1 parent a5feba0 commit 03b4560
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
6 changes: 2 additions & 4 deletions source/common/upstream/cluster_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1023,16 +1023,14 @@ void ClusterManagerImpl::updateClusterCounts() {
init_helper_.state() == ClusterManagerInitHelper::State::AllClustersInitialized;
if (all_clusters_initialized && ads_mux_) {
const auto type_url = Config::getTypeUrl<envoy::config::cluster::v3::Cluster>();
if (last_recorded_warming_clusters_count_ == 0 && !warming_clusters_.empty()) {
resume_cds_.reset();
if (resume_cds_ == nullptr && !warming_clusters_.empty()) {
resume_cds_ = ads_mux_->pause(type_url);
} else if (last_recorded_warming_clusters_count_ > 0 && warming_clusters_.empty()) {
} else if (warming_clusters_.empty()) {
resume_cds_.reset();
}
}
cm_stats_.active_clusters_.set(active_clusters_.size());
cm_stats_.warming_clusters_.set(warming_clusters_.size());
last_recorded_warming_clusters_count_ = warming_clusters_.size();
}

ThreadLocalCluster* ClusterManagerImpl::getThreadLocalCluster(absl::string_view cluster) {
Expand Down
9 changes: 0 additions & 9 deletions source/common/upstream/cluster_manager_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -936,15 +936,6 @@ class ClusterManagerImpl : public ClusterManager,
bool initialized_{};
bool ads_mux_initialized_{};
std::atomic<bool> shutdown_{};

// Records the last `warming_clusters_` map size from updateClusterCounts(). This variable is
// used for bookkeeping to run the `resume_cds_` cleanup that decrements the pause count and
// enables the resumption of DiscoveryRequests for the Cluster type url.
//
// The `warming_clusters` gauge is not suitable for this purpose, because different environments
// (e.g. mobile) may have different stats enabled, leading to the gauge not having a reliable
// previous warming clusters size value.
std::size_t last_recorded_warming_clusters_count_{0};
};

} // namespace Upstream
Expand Down

0 comments on commit 03b4560

Please sign in to comment.