From ca32538f63aba801d11edcb30906a5a61538faa5 Mon Sep 17 00:00:00 2001 From: Dominik Gleich <dominik.gleich@memgraph.io> Date: Tue, 23 Jan 2018 12:52:25 +0100 Subject: [PATCH] Fix set of clients Reviewers: florijan Reviewed By: florijan Differential Revision: https://phabricator.memgraph.io/D1133 --- src/distributed/rpc_worker_clients.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/distributed/rpc_worker_clients.hpp b/src/distributed/rpc_worker_clients.hpp index b0e3af8c5..5e0a26f35 100644 --- a/src/distributed/rpc_worker_clients.hpp +++ b/src/distributed/rpc_worker_clients.hpp @@ -54,12 +54,13 @@ class RpcWorkerClients { int skip_worker_id, std::function<TResult(communication::rpc::Client &)> execute) { std::vector<std::future<TResult>> futures; - for (auto &client : clients_) { - if (client.first == skip_worker_id) continue; + for (auto &worker_id : coordination_.GetWorkerIds()) { + if (worker_id == skip_worker_id) continue; + auto &client = GetClient(worker_id); futures.emplace_back( std::async(std::launch::async, - [&execute, &client]() { return execute(client.second); })); + [&execute, &client]() { return execute(client); })); } return futures; }