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

:bug: fix data race on recorded events

parent 4114edaa
No related branches found
No related tags found
No related merge requests found
...@@ -16,13 +16,11 @@ var lock sync.Mutex ...@@ -16,13 +16,11 @@ var lock sync.Mutex
func Configure(plugin *node.Plugin) { func Configure(plugin *node.Plugin) {
server.Events.AddNode.Attach(events.NewClosure(func(nodeId string) { server.Events.AddNode.Attach(events.NewClosure(func(nodeId string) {
if _, exists := nodes[nodeId]; !exists { lock.Lock()
lock.Lock() defer lock.Unlock()
defer lock.Unlock()
if _, exists := nodes[nodeId]; !exists { if _, exists := nodes[nodeId]; !exists {
nodes[nodeId] = false nodes[nodeId] = false
}
} }
})) }))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment