Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ SDK: Delete local node for gRPC-rere #2597

Merged
merged 2 commits into from
Nov 14, 2023
Merged
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
11 changes: 9 additions & 2 deletions src/cc/flwr/src/grpc_rere.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ std::optional<flwr::proto::Node> get_node_from_store() {
return node->second;
}

void delete_node_from_store() {
std::lock_guard<std::mutex> lock(node_store_mutex);
auto node = node_store.find(KEY_NODE);
if (node == node_store.end() || !node->second.has_value()) {
node_store.erase(node);
}
}

std::optional<flwr::proto::TaskIns> get_current_task_ins() {
std::lock_guard<std::mutex> state_lock(state_mutex);
auto current_task_ins = state.find(KEY_TASK_INS);
Expand Down Expand Up @@ -80,8 +88,7 @@ void delete_node(const std::unique_ptr<flwr::proto::Fleet::Stub> &stub) {
delete_node_request.release_node(); // Release if status is ok
}

// TODO: Check if Node needs to be removed from local map
// node_store.erase(node);
delete_node_from_store();
}

std::optional<flwr::proto::TaskIns>
Expand Down