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
func Configure(plugin *node.Plugin) {
server.Events.AddNode.Attach(events.NewClosure(func(nodeId string) {
if _, exists := nodes[nodeId]; !exists {
lock.Lock()
defer lock.Unlock()
lock.Lock()
defer lock.Unlock()
if _, exists := nodes[nodeId]; !exists {
nodes[nodeId] = false
}
if _, exists := nodes[nodeId]; !exists {
nodes[nodeId] = false
}
}))
......
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