fix another dead relay issue (relays dying but subscriptions living forever and not being reconnected).

This commit is contained in:
fiatjaf
2026-03-20 20:26:59 -03:00
parent 55c5194bdf
commit 0630bbe4e9
+10
View File
@@ -620,6 +620,16 @@ func (r *Relay) PrepareSubscription(ctx context.Context, filter Filter, opts Sub
}()
}
// if the relay connection dies, cancel this subscription
go func() {
select {
case <-sub.Context.Done():
return
case <-r.connectionContext.Done():
sub.cancel(context.Cause(r.connectionContext))
}
}()
// start handling events, eose, unsub etc:
go func() {
<-sub.Context.Done()