Skip to content
Snippets Groups Projects
Commit 83d12c1a authored by capossele's avatar capossele
Browse files

:bug: fix nodes data race

parent 6e82f204
No related branches found
No related tags found
No related merge requests found
......@@ -76,6 +76,9 @@ func Configure(plugin *node.Plugin) {
}
func Replay(handlers *types.EventHandlers) {
lock.Lock()
defer lock.Unlock()
for nodeId, online := range nodes {
handlers.AddNode(nodeId)
if online {
......@@ -84,8 +87,7 @@ func Replay(handlers *types.EventHandlers) {
handlers.NodeOffline(nodeId)
}
}
lock.Lock()
defer lock.Unlock()
for sourceId, targetMap := range links {
for targetId := range targetMap {
handlers.ConnectNodes(sourceId, targetId)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment