Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions source/common/upstream/upstream_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,11 @@ HostVector filterHosts(const std::unordered_set<HostSharedPtr>& hosts,
HostVector net_hosts;
net_hosts.reserve(hosts.size());

std::set_difference(hosts.begin(), hosts.end(), excluded_hosts.begin(), excluded_hosts.end(),
std::inserter(net_hosts, net_hosts.begin()));
for (const auto& host : hosts) {
if (excluded_hosts.find(host) == excluded_hosts.end()) {
net_hosts.emplace_back(host);
}
}

return net_hosts;
}
Expand Down Expand Up @@ -1144,6 +1147,7 @@ bool BaseDynamicClusterImpl::updateDynamicHostList(const HostVector& new_hosts,
// Did the priority change?
if (host->priority() != existing_host->second->priority()) {
existing_host->second->priority(host->priority());
hosts_added_to_current_priority.emplace_back(existing_host->second);
}

existing_host->second->weight(host->weight());
Expand Down
6 changes: 6 additions & 0 deletions test/common/upstream/eds_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,12 @@ TEST_F(EdsTest, EndpointMoved) {
add_endpoint(81, 0);
add_endpoint(80, 1);

// Verify that no hosts gets added or removed to/from the PrioritySet.
cluster_->prioritySet().addMemberUpdateCb([&](const auto& added, const auto& removed) {
EXPECT_TRUE(added.empty());
EXPECT_TRUE(removed.empty());
});

VERBOSE_EXPECT_NO_THROW(cluster_->onConfigUpdate(resources, ""));

{
Expand Down