efemoney
07/05/2025, 8:01 PMasync
operations but I want to select the first one that succeeds OR fail only after everyone fails. Seems current select with onAwait
will fail when any of the operations fail, is there a way to achieve the other behavior?Rob
07/05/2025, 8:11 PMstreetsofboston
07/05/2025, 8:15 PMsuspend fun <T> race(vararg tasks: suspend () -> T): T =
channelFlow { tasks.forEach { launch { send(it()) } } }.first()
Rob
07/05/2025, 8:22 PMrunCatching
efemoney
07/05/2025, 11:41 PMRob
07/05/2025, 11:55 PMRob
07/05/2025, 11:56 PM