mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-04-03 09:28:14 +02:00
clear context differentiation on submany/unique.
This commit is contained in:
parent
7d1091b66b
commit
edefc57b28
32
pool.go
32
pool.go
@ -86,17 +86,17 @@ func (pool *SimplePool) subMany(ctx context.Context, urls []string, filters Filt
|
||||
}
|
||||
|
||||
for evt := range sub.Events {
|
||||
stop := false
|
||||
if unique {
|
||||
_, stop = seenAlready.LoadOrStore(evt.ID, true)
|
||||
}
|
||||
if !stop {
|
||||
select {
|
||||
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
if _, seen := seenAlready.LoadOrStore(evt.ID, true); seen {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
pending.Dec()
|
||||
@ -160,17 +160,17 @@ func (pool *SimplePool) subManyEose(ctx context.Context, urls []string, filters
|
||||
return
|
||||
}
|
||||
|
||||
stop := false
|
||||
if unique {
|
||||
_, stop = seenAlready.LoadOrStore(evt.ID, true)
|
||||
}
|
||||
if !stop {
|
||||
select {
|
||||
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
if _, seen := seenAlready.LoadOrStore(evt.ID, true); seen {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}(NormalizeURL(url))
|
||||
|
Loading…
x
Reference in New Issue
Block a user