Commit ff83754a authored by Ted Yu's avatar Ted Yu Committed by Ted Yu

Use read lock for reconciler#getHandlers

parent 82bfa667
......@@ -100,9 +100,7 @@ func (asw *actualStateOfWorld) RemovePlugin(socketPath string) {
asw.Lock()
defer asw.Unlock()
if _, ok := asw.socketFileToInfo[socketPath]; ok {
delete(asw.socketFileToInfo, socketPath)
}
delete(asw.socketFileToInfo, socketPath)
}
func (asw *actualStateOfWorld) GetRegisteredPlugins() []PluginInfo {
......
......@@ -147,9 +147,7 @@ func (dsw *desiredStateOfWorld) RemovePlugin(socketPath string) {
dsw.Lock()
defer dsw.Unlock()
if _, ok := dsw.socketFileToInfo[socketPath]; ok {
delete(dsw.socketFileToInfo, socketPath)
}
delete(dsw.socketFileToInfo, socketPath)
}
func (dsw *desiredStateOfWorld) GetPluginsToRegister() []PluginInfo {
......
......@@ -97,8 +97,8 @@ func (rc *reconciler) AddHandler(pluginType string, pluginHandler cache.PluginHa
}
func (rc *reconciler) getHandlers() map[string]cache.PluginHandler {
rc.Lock()
defer rc.Unlock()
rc.RLock()
defer rc.RUnlock()
return rc.handlers
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment