fix concurrent map writes (#2079)

Co-authored-by: wero <wero@werodeMacBook-Pro.local>
master
givemeafish 2 years ago committed by GitHub
parent f2cef2b963
commit 6a4885ba64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -191,9 +191,11 @@ func (c *cluster) handleWatchEvents(key string, events []*clientv3.Event) {
})
}
case clientv3.EventTypeDelete:
c.lock.Lock()
if vals, ok := c.values[key]; ok {
delete(vals, string(ev.Kv.Key))
}
c.lock.Unlock()
for _, l := range listeners {
l.OnDelete(KV{
Key: string(ev.Kv.Key),

Loading…
Cancel
Save