dry sub.unsub() on context cancelation.
This commit is contained in:
@@ -86,11 +86,7 @@ func (sub *Subscription) Fire(ctx context.Context) error {
|
|||||||
go func() {
|
go func() {
|
||||||
<-sub.Relay.ConnectionContext.Done()
|
<-sub.Relay.ConnectionContext.Done()
|
||||||
|
|
||||||
// this will close the Events channel,
|
// cancel the context -- this will cause the other context cancelation cause above to be called
|
||||||
// which can be used by an external reader to learn the subscription has stopped
|
|
||||||
sub.Unsub()
|
|
||||||
|
|
||||||
// we also cancel the context
|
|
||||||
cancel()
|
cancel()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user