mirror of
https://github.com/rancher/steve.git
synced 2025-09-26 15:25:33 +00:00
Fix map concurrent read/write
This commit is contained in:
@@ -126,11 +126,16 @@ func (s *WatchSession) watch(conn *websocket.Conn, resp chan types.APIEvent) err
|
||||
|
||||
if sub.Stop {
|
||||
s.stop(sub.ResourceType, resp)
|
||||
} else if _, ok := s.watchers[sub.ResourceType]; !ok {
|
||||
} else {
|
||||
s.Lock()
|
||||
_, ok := s.watchers[sub.ResourceType]
|
||||
s.Unlock()
|
||||
if !ok {
|
||||
s.add(sub.ResourceType, sub.ResourceVersion, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func sendErr(resp chan<- types.APIEvent, err error, resourceType string) {
|
||||
resp <- types.APIEvent{
|
||||
|
Reference in New Issue
Block a user