release a goroutine that could leak in some conditions.

This commit is contained in:
fiatjaf
2025-09-07 18:56:26 -03:00
parent 9933bb7865
commit b67e3092b0

View File

@@ -364,8 +364,11 @@ func (r *Relay) Subscribe(ctx context.Context, filter Filter, opts SubscriptionO
} }
go func() { go func() {
<-r.connection.closedNotify select {
sub.unsub(ErrDisconnected) case <-r.connection.closedNotify:
sub.unsub(ErrDisconnected)
case <-ctx.Done():
}
}() }()
return sub, nil return sub, nil