Skip to content

Commit

Permalink
Fix node timeout handling in sync.Map traversal
Browse files Browse the repository at this point in the history
  • Loading branch information
kerwenwwer committed Apr 9, 2024
1 parent ca318ab commit b93cb64
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cmd/opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ func (nodeList *NodeList) Get() []common.Node {
nodeList.nodes.Range(func(k, v interface{}) bool {
//If this node has not been updated for a while, delete it
if v.(int64)+nodeList.Timeout < time.Now().Unix() {
// nodeList.nodes.Delete(k)
// nodeList.println("[[Timeout]:", k, "has been deleted]")
nodes = append(nodes, k.(common.Node))
nodeList.nodes.Delete(k)
nodeList.println("[[Timeout]:", k, "has been deleted]")
} else {
nodes = append(nodes, k.(common.Node))
}
Expand Down

0 comments on commit b93cb64

Please sign in to comment.