Fix set of clients

Reviewers: florijan

Reviewed By: florijan

Differential Revision: https://phabricator.memgraph.io/D1133
This commit is contained in:
Dominik Gleich 2018-01-23 12:52:25 +01:00
parent 5ad39a8735
commit ca32538f63

View File

@ -54,12 +54,13 @@ class RpcWorkerClients {
int skip_worker_id, int skip_worker_id,
std::function<TResult(communication::rpc::Client &)> execute) { std::function<TResult(communication::rpc::Client &)> execute) {
std::vector<std::future<TResult>> futures; std::vector<std::future<TResult>> futures;
for (auto &client : clients_) { for (auto &worker_id : coordination_.GetWorkerIds()) {
if (client.first == skip_worker_id) continue; if (worker_id == skip_worker_id) continue;
auto &client = GetClient(worker_id);
futures.emplace_back( futures.emplace_back(
std::async(std::launch::async, std::async(std::launch::async,
[&execute, &client]() { return execute(client.second); })); [&execute, &client]() { return execute(client); }));
} }
return futures; return futures;
} }