Skip to content

Commit

Permalink
event: unlock mutex before sending event on channel
Browse files Browse the repository at this point in the history
Just hold the mutex for as little time as possible.
  • Loading branch information
fsouza committed Jan 6, 2019
1 parent 59aedce commit a107859
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion event.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,11 @@ func (c *Client) eventHijack(startTime int64, eventChan chan *APIEvents, errChan
c.eventMonitor.RLock()
if c.eventMonitor.enabled && c.eventMonitor.C == eventChan {
// Signal that we're exiting.
c.eventMonitor.RUnlock()
eventChan <- EOFEvent
} else {
c.eventMonitor.RUnlock()
}
c.eventMonitor.RUnlock()
break
}
errChan <- err
Expand Down

0 comments on commit a107859

Please sign in to comment.