mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-06-01 10:39:19 +02:00
simplify pre-eose cleanup in pool.subMany()
This commit is contained in:
parent
cb8b40bd00
commit
32c1969397
6
pool.go
6
pool.go
@ -141,17 +141,13 @@ func (pool *SimplePool) subMany(ctx context.Context, urls []string, filters Filt
|
||||
eose = true
|
||||
case <-ticker.C:
|
||||
if eose {
|
||||
del := map[string]struct{}{}
|
||||
old := Timestamp(time.Now().Add(-seenAlreadyDropTick).Unix())
|
||||
seenAlready.Range(func(id string, value Timestamp) bool {
|
||||
if value < old {
|
||||
del[id] = struct{}{}
|
||||
seenAlready.Delete(id)
|
||||
}
|
||||
return true
|
||||
})
|
||||
for k := range del {
|
||||
seenAlready.Delete(k)
|
||||
}
|
||||
}
|
||||
case reason := <-sub.ClosedReason:
|
||||
log.Printf("CLOSED from %s: '%s'\n", nm, reason)
|
||||
|
Loading…
x
Reference in New Issue
Block a user