mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 21:32:56 +01:00
pool: bug that was causing a SubMany() to close if any of the relays failed to connect.
fixes https://github.com/nbd-wtf/go-nostr/issues/172
This commit is contained in:
parent
3de002aca1
commit
e0ed40613d
4
pool.go
4
pool.go
@ -254,7 +254,7 @@ func (pool *SimplePool) subMany(
|
||||
eoseChan chan struct{},
|
||||
opts ...SubscriptionOption,
|
||||
) chan RelayEvent {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
ctx, cancel := context.WithCancelCause(ctx)
|
||||
_ = cancel // do this so `go vet` will stop complaining
|
||||
events := make(chan RelayEvent)
|
||||
seenAlready := xsync.NewMapOf[string, Timestamp]()
|
||||
@ -288,11 +288,11 @@ func (pool *SimplePool) subMany(
|
||||
pending.Dec()
|
||||
if pending.Value() == 0 {
|
||||
close(events)
|
||||
cancel(fmt.Errorf("aborted: %w", context.Cause(ctx)))
|
||||
}
|
||||
if !eosed {
|
||||
eoseWg.Done()
|
||||
}
|
||||
cancel()
|
||||
}()
|
||||
|
||||
hasAuthed := false
|
||||
|
Loading…
x
Reference in New Issue
Block a user