Skip to content

Commit

Permalink
handle more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Nov 14, 2021
1 parent 21cd1d2 commit d4fc309
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions subscriber.go
Expand Up @@ -68,8 +68,8 @@ func (s *Subscriber) Dispatch(u *Update, fromHistory bool) bool {
s.liveMutex.Unlock()
}

s.outMutex.RLock()
defer s.outMutex.RUnlock()
s.outMutex.Lock()
defer s.outMutex.Unlock()
if atomic.LoadInt32(&s.disconnected) > 0 {
return false
}
Expand All @@ -83,6 +83,8 @@ func (s *Subscriber) Dispatch(u *Update, fromHistory bool) bool {
func (s *Subscriber) Ready() int {
s.liveMutex.Lock()
defer s.liveMutex.Unlock()
s.outMutex.Lock()
defer s.outMutex.Unlock()

n := len(s.liveQueue)
for _, u := range s.liveQueue {
Expand Down

0 comments on commit d4fc309

Please sign in to comment.