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 {
|
||||
stop := false
|
||||
if unique {
|
||||
_, stop = seenAlready.LoadOrStore(evt.ID, true)
|
||||
if _, seen := seenAlready.LoadOrStore(evt.ID, true); seen {
|
||||
continue
|
||||
}
|
||||
if !stop {
|
||||
}
|
||||
|
||||
select {
|
||||
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pending.Dec()
|
||||
if pending.Value() == 0 {
|
||||
@@ -160,11 +160,12 @@ func (pool *SimplePool) subManyEose(ctx context.Context, urls []string, filters
|
||||
return
|
||||
}
|
||||
|
||||
stop := false
|
||||
if unique {
|
||||
_, stop = seenAlready.LoadOrStore(evt.ID, true)
|
||||
if _, seen := seenAlready.LoadOrStore(evt.ID, true); seen {
|
||||
continue
|
||||
}
|
||||
if !stop {
|
||||
}
|
||||
|
||||
select {
|
||||
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
||||
case <-ctx.Done():
|
||||
@@ -172,7 +173,6 @@ func (pool *SimplePool) subManyEose(ctx context.Context, urls []string, filters
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}(NormalizeURL(url))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user