Skip to content

Commit 0a10303

Browse files
committed
Only mark unavailable server as traversed
1 parent 7501ec0 commit 0a10303

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/brpc/policy/weighted_randomized_load_balancer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ int WeightedRandomizedLoadBalancer::SelectServer(const SelectIn& in, SelectOut*
139139
std::lower_bound(s->server_list.begin(), s->server_list.end(),
140140
random_server, server_compare);
141141
const SocketId id = server->id;
142-
random_traversed.insert(id);
143-
if (0 != IsServerAvailable(id, out->ptr)) {
142+
if (ExcludedServers::IsExcluded(in.excluded, id)) {
144143
continue;
145144
}
146-
if (!ExcludedServers::IsExcluded(in.excluded, id)) {
145+
random_traversed.insert(id);
146+
if (0 == IsServerAvailable(id, out->ptr)) {
147147
// An available server is found.
148148
return 0;
149149
}

0 commit comments

Comments
 (0)