clear context differentiation on submany/unique.
This commit is contained in:
16
pool.go
16
pool.go
@@ -86,18 +86,18 @@ func (pool *SimplePool) subMany(ctx context.Context, urls []string, filters Filt
|
|||||||
}
|
}
|
||||||
|
|
||||||
for evt := range sub.Events {
|
for evt := range sub.Events {
|
||||||
stop := false
|
|
||||||
if unique {
|
if unique {
|
||||||
_, stop = seenAlready.LoadOrStore(evt.ID, true)
|
if _, seen := seenAlready.LoadOrStore(evt.ID, true); seen {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
if !stop {
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pending.Dec()
|
pending.Dec()
|
||||||
if pending.Value() == 0 {
|
if pending.Value() == 0 {
|
||||||
@@ -160,11 +160,12 @@ func (pool *SimplePool) subManyEose(ctx context.Context, urls []string, filters
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
stop := false
|
|
||||||
if unique {
|
if unique {
|
||||||
_, stop = seenAlready.LoadOrStore(evt.ID, true)
|
if _, seen := seenAlready.LoadOrStore(evt.ID, true); seen {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
if !stop {
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
@@ -172,7 +173,6 @@ func (pool *SimplePool) subManyEose(ctx context.Context, urls []string, filters
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}(NormalizeURL(url))
|
}(NormalizeURL(url))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user