From beff7e60b7565d517ba0251afbd9e03eab455277 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Fri, 3 Oct 2025 13:20:56 -0300 Subject: [PATCH] Fix sendAndWaitForResponse never receiving a response --- .../relay/client/accessories/NostrClientSendAndWaitExt.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/accessories/NostrClientSendAndWaitExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/accessories/NostrClientSendAndWaitExt.kt index 0fed3c8d1..248a358fe 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/accessories/NostrClientSendAndWaitExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/accessories/NostrClientSendAndWaitExt.kt @@ -95,6 +95,7 @@ suspend fun INostrClient.sendAndWaitForResponse( val receivedResults = mutableMapOf() // The withTimeout block will cancel the coroutine if the loop takes too long withTimeoutOrNull(timeoutInSeconds * 1000) { + send(event, relayList) while (receivedResults.size < relayList.size) { val result = resultChannel.receive() @@ -109,8 +110,6 @@ suspend fun INostrClient.sendAndWaitForResponse( } } - send(event, relayList) - val receivedResults = resultSubscription.await() unsubscribe(subscription)