Commit eaea13a5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 890384bb
...@@ -278,14 +278,25 @@ func (s *storage) watcher() { ...@@ -278,14 +278,25 @@ func (s *storage) watcher() {
} }
} }
// deliver event to all watchers // deliver event to all watchers.
// handle add/del watchq in the process.
deliver:
for watchq := range s.watchTab { for watchq := range s.watchTab {
for {
select { select {
case req := <-s.watchReq: case req := <-s.watchReq:
serveReq(req) serveReq(req)
// if watchq was removed - we have to skip sending to it
// else try sending to current watchq once again.
_, present := s.watchTab[watchq]
if !present {
continue deliver
}
case watchq <- event: case watchq <- event:
// ok // ok
continue deliver
}
} }
} }
} }
......
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