Fix sendAndWaitForResponse never receiving a response
This commit is contained in:
+1
-2
@@ -95,6 +95,7 @@ suspend fun INostrClient.sendAndWaitForResponse(
|
|||||||
val receivedResults = mutableMapOf<NormalizedRelayUrl, Boolean>()
|
val receivedResults = mutableMapOf<NormalizedRelayUrl, Boolean>()
|
||||||
// The withTimeout block will cancel the coroutine if the loop takes too long
|
// The withTimeout block will cancel the coroutine if the loop takes too long
|
||||||
withTimeoutOrNull(timeoutInSeconds * 1000) {
|
withTimeoutOrNull(timeoutInSeconds * 1000) {
|
||||||
|
send(event, relayList)
|
||||||
while (receivedResults.size < relayList.size) {
|
while (receivedResults.size < relayList.size) {
|
||||||
val result = resultChannel.receive()
|
val result = resultChannel.receive()
|
||||||
|
|
||||||
@@ -109,8 +110,6 @@ suspend fun INostrClient.sendAndWaitForResponse(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
send(event, relayList)
|
|
||||||
|
|
||||||
val receivedResults = resultSubscription.await()
|
val receivedResults = resultSubscription.await()
|
||||||
|
|
||||||
unsubscribe(subscription)
|
unsubscribe(subscription)
|
||||||
|
|||||||
Reference in New Issue
Block a user