dry sub.unsub() on context cancelation.

This commit is contained in:
fiatjaf
2023-03-18 16:07:19 -03:00
parent e9ad77c822
commit 46e724b8d5

View File

@@ -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()
}() }()