|
|
@ -62,11 +62,14 @@ func (cm *ControlManager) Add(runId string, ctl *Control) (oldCtl *Control) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (cm *ControlManager) Del(runId string) {
|
|
|
|
// we should make sure if it's the same control to prevent delete a new one
|
|
|
|
|
|
|
|
func (cm *ControlManager) Del(runId string, ctl *Control) {
|
|
|
|
cm.mu.Lock()
|
|
|
|
cm.mu.Lock()
|
|
|
|
defer cm.mu.Unlock()
|
|
|
|
defer cm.mu.Unlock()
|
|
|
|
|
|
|
|
if c, ok := cm.ctlsByRunId[runId]; ok && c == ctl {
|
|
|
|
delete(cm.ctlsByRunId, runId)
|
|
|
|
delete(cm.ctlsByRunId, runId)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (cm *ControlManager) GetById(runId string) (ctl *Control, ok bool) {
|
|
|
|
func (cm *ControlManager) GetById(runId string) (ctl *Control, ok bool) {
|
|
|
|
cm.mu.RLock()
|
|
|
|
cm.mu.RLock()
|
|
|
|