Skip to content

Commit

Permalink
4
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Apr 29, 2024
1 parent 9642027 commit f93360c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/client/partition_resolver_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,18 @@ void partition_resolver_simple::handle_pending_requests(std::deque<request_conte
host_port partition_resolver_simple::get_host_port(const partition_configuration &pc) const
{
if (_app_is_stateful) {
return pc.hp_primary1;
host_port primary;
GET_HOST_PORT(pc, primary1, primary);
return primary;
}

if (pc.hp_last_drops1.empty()) {
std::vector<host_port> last_drops;
GET_HOST_PORTS(pc, last_drops1, last_drops);
if (last_drops.empty()) {
return host_port();
}

return pc.hp_last_drops1[rand::next_u32(0, pc.last_drops1.size() - 1)];
return last_drops[rand::next_u32(0, last_drops.size() - 1)];
}

error_code partition_resolver_simple::get_host_port(int partition_index, /*out*/ host_port &hp)
Expand Down

0 comments on commit f93360c

Please sign in to comment.