Skip to content

Commit

Permalink
Fix a race in Close method of SubscriptionClient (shurcooL#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
davitovmasyan authored Jan 11, 2022
1 parent 9eed82e commit 01a575e
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,14 +557,12 @@ func (sc *SubscriptionClient) Reset() error {
func (sc *SubscriptionClient) Close() (err error) {
sc.setIsRunning(false)

sc.subscribersMu.Lock()
for id := range sc.subscriptions {
if err = sc.Unsubscribe(id); err != nil {
sc.cancel()
return err
}
}
sc.subscribersMu.Unlock()

if sc.conn != nil {
_ = sc.terminate()
Expand Down

0 comments on commit 01a575e

Please sign in to comment.