From 46e724b8d572b7eb79dc847802a17ffd0bdb7455 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 18 Mar 2023 16:07:19 -0300 Subject: [PATCH] dry sub.unsub() on context cancelation. --- subscription.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/subscription.go b/subscription.go index 70819ba..71326b4 100644 --- a/subscription.go +++ b/subscription.go @@ -86,11 +86,7 @@ func (sub *Subscription) Fire(ctx context.Context) error { go func() { <-sub.Relay.ConnectionContext.Done() - // this will close the Events channel, - // which can be used by an external reader to learn the subscription has stopped - sub.Unsub() - - // we also cancel the context + // cancel the context -- this will cause the other context cancelation cause above to be called cancel() }()