Does it make sense that a `Deferred` inside a `sup...
# coroutines
m
Does it make sense that a
Deferred
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.
Note I mean when I am checking them while still inside the supervisorScope i.e.
Copy code
supervisorScope {
  job1 = async { throw ... }
  job2 = async { delay(10000) }
  
  while (true) {
    delay(1000)
    job1.isComplete  <-- stays false until after the 10 seconds are up
  }
}
I found the problem, an extension function I had written to wrap the micrometer
timeCallable
method.
Copy code
/** Times an asynchronous [function] and returns it's result [T]. */
suspend fun <T> Timer.asyncRecordCallable(func: suspend () -> T): T {
    return this.recordCallable { runBlocking { func() } }
}
b
That
runBlocking
got the better of me once too...