mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 22:06:43 +01:00
Avoid sending close to subs that are already closed.
This commit is contained in:
@@ -231,7 +231,10 @@ class NostrClient(
|
|||||||
|
|
||||||
if (newFilters.isNullOrEmpty()) {
|
if (newFilters.isNullOrEmpty()) {
|
||||||
// some relays are not in this sub anymore. Stop their subscriptions
|
// some relays are not in this sub anymore. Stop their subscriptions
|
||||||
|
if (!oldFilters.isNullOrEmpty()) {
|
||||||
|
// only update if the old filters are not already closed.
|
||||||
relayPool.close(relay, subId)
|
relayPool.close(relay, subId)
|
||||||
|
}
|
||||||
} else if (oldFilters.isNullOrEmpty()) {
|
} else if (oldFilters.isNullOrEmpty()) {
|
||||||
// new relays were added. Start a new sub in them
|
// new relays were added. Start a new sub in them
|
||||||
relayPool.sendRequest(relay, subId, newFilters)
|
relayPool.sendRequest(relay, subId, newFilters)
|
||||||
@@ -267,7 +270,10 @@ class NostrClient(
|
|||||||
|
|
||||||
if (newFilters.isNullOrEmpty()) {
|
if (newFilters.isNullOrEmpty()) {
|
||||||
// some relays are not in this sub anymore. Stop their subscriptions
|
// some relays are not in this sub anymore. Stop their subscriptions
|
||||||
|
if (!oldFilters.isNullOrEmpty()) {
|
||||||
|
// only update if the old filters are not already closed.
|
||||||
relayPool.close(relay, subId)
|
relayPool.close(relay, subId)
|
||||||
|
}
|
||||||
} else if (oldFilters.isNullOrEmpty()) {
|
} else if (oldFilters.isNullOrEmpty()) {
|
||||||
// new relays were added. Start a new sub in them
|
// new relays were added. Start a new sub in them
|
||||||
relayPool.sendCount(relay, subId, newFilters)
|
relayPool.sendCount(relay, subId, newFilters)
|
||||||
|
|||||||
Reference in New Issue
Block a user