tad
12/11/2023, 8:18 PMhttpClient.coroutineContext.job.children.forEach { it.cancelAndJoin() }
But that doesn't seem to do what I expect, which is to suspend until all in-flight requests are canceled and completed. Another idea is to cancel the job entirely and construct a new HttpClient, but I'd like to avoid this if possible as it means reworking quite a bit of DI architecture. Does anyone here have any ideas how I can cancel all requests that are in-flight?Aleksei Tirman [JB]
12/12/2023, 8:07 AMval scope = CoroutineScope(<http://Dispatchers.IO|Dispatchers.IO>)
scope.launch {
client.get("<https://httpbin.org/delay/10>")
client.get("<https://httpbin.org/delay/10>")
}
// ...
scope.cancel()