Fixes suspending on coroutineScope and never returning bug
This commit is contained in:
+4
-1
@@ -91,6 +91,7 @@ suspend fun INostrClient.sendAndWaitForResponse(
|
||||
// subscribe before sending the result.
|
||||
val resultSubscription =
|
||||
coroutineScope {
|
||||
val result =
|
||||
async(Dispatchers.IO) {
|
||||
val receivedResults = mutableMapOf<NormalizedRelayUrl, Boolean>()
|
||||
// The withTimeout block will cancel the coroutine if the loop takes too long
|
||||
@@ -107,10 +108,12 @@ suspend fun INostrClient.sendAndWaitForResponse(
|
||||
}
|
||||
receivedResults
|
||||
}
|
||||
}
|
||||
|
||||
send(event, relayList)
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
val receivedResults = resultSubscription.await()
|
||||
|
||||
unsubscribe(subscription)
|
||||
|
||||
Reference in New Issue
Block a user