fix "<forced-ping>" mismatch.

fixes https://github.com/nbd-wtf/nostr-tools/issues/539
This commit is contained in:
fiatjaf
2026-07-29 16:43:49 -03:00
parent 5609bab1ac
commit 7fa1ef45c5
+6 -4
View File
@@ -670,10 +670,12 @@ export class Subscription {
this.relay.openSubs.delete(this.id) this.relay.openSubs.delete(this.id)
// compute idleness state // compute idleness state
this.relay.ongoingOperations-- if (!this.id.startsWith('<forced-ping>')) {
if (this.relay.ongoingOperations === 0) { this.relay.ongoingOperations--
this.relay.idleSince = Date.now() if (this.relay.ongoingOperations === 0) {
this.relay.scheduleIdleClose() this.relay.idleSince = Date.now()
this.relay.scheduleIdleClose()
}
} }
this.onclose?.(reason) this.onclose?.(reason)