From 19c60fa3a8a363d6623c385dfec5c1806302dd4e Mon Sep 17 00:00:00 2001 From: Zohaib Date: Thu, 1 Sep 2022 08:35:25 -0700 Subject: [PATCH] Fixing bug in nodeMap update logic --- lib/raft.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/raft.go b/lib/raft.go index e671390..e232211 100644 --- a/lib/raft.go +++ b/lib/raft.go @@ -264,10 +264,10 @@ func (r *RaftServer) mutateNodeMap(nodeID uint64, f func(map[uint64]bool)) { } f(m) + r.nodeMap[nodeID] = m + if len(m) <= 0 { delete(r.nodeMap, nodeID) - } else { - r.nodeMap[nodeID] = m } }