Fix eose count on subscriptions against targets with fewer connections than relays

This commit is contained in:
Jon Staab
2024-10-31 14:04:37 -07:00
parent 5038046608
commit 51f9ae2e29
+2 -2
View File
@@ -233,7 +233,7 @@ const _executeSubscription = (sub: Subscription) => {
emitter.on(SubscriptionEvent.Eose, (url: string) => {
completedRelays.add(url)
if (closeOnEose && completedRelays.size === executor.target.connections.length) {
if (closeOnEose && completedRelays.size === uniq(relays).length) {
onComplete()
}
})
@@ -241,7 +241,7 @@ const _executeSubscription = (sub: Subscription) => {
emitter.on(SubscriptionEvent.Close, (url: string) => {
completedRelays.add(url)
if (completedRelays.size === executor.target.connections.length) {
if (completedRelays.size === uniq(relays).length) {
onComplete()
}
})