mirror of
https://github.com/niusmallnan/steve.git
synced 2025-08-24 15:58:38 +00:00
Fix map concurrent read/write
(cherry picked from commit 72db28d5ea
)
Signed-off-by: niusmallnan <niusmallnan@gmail.com>
This commit is contained in:
parent
dc9f969673
commit
5880c657c3
@ -126,8 +126,13 @@ 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 {
|
||||
s.add(sub.ResourceType, sub.ResourceVersion, resp)
|
||||
} else {
|
||||
s.Lock()
|
||||
_, ok := s.watchers[sub.ResourceType]
|
||||
s.Unlock()
|
||||
if !ok {
|
||||
s.add(sub.ResourceType, sub.ResourceVersion, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user