Mark Allanson
06/11/2021, 3:45 PMDeferred
inside a supervisorJob
continues to report as active until all the co-routines are complete? I was expecting the child jobs move to a completed state once they themselves finished, instead of only transitioning to completed when all have done so.supervisorScope {
job1 = async { throw ... }
job2 = async { delay(10000) }
while (true) {
delay(1000)
job1.isComplete <-- stays false until after the 10 seconds are up
}
}
timeCallable
method.
/** Times an asynchronous [function] and returns it's result [T]. */
suspend fun <T> Timer.asyncRecordCallable(func: suspend () -> T): T {
return this.recordCallable { runBlocking { func() } }
}
baxter
06/11/2021, 4:48 PMrunBlocking
got the better of me once too...