marcelo
11/05/2018, 2:20 PMreturn templates.map { renderTemplatePath ->
runBlocking {
val result = async {
renderMetricTimer.tagVal(package).time {
//code
}
}
result.await()
}.toSet()
}
Obviously, I am new to coroutines, but this seems like a lot of coroutine builders, no?spand
11/05/2018, 2:21 PMmarcelo
11/05/2018, 2:22 PMtimer
function is a suspend
function.suspend fun <T> NeedsTag1<BooleanTagValue, Timer>.time(toTime: suspend () -> T): T {
val timerStarted = this.start()
try {
val result = toTime()
timerStarted.tagVal(true).stop()
return result
} catch (e: Throwable) {
timerStarted.tagVal(false).stop()
throw e
}
}`
spand
11/05/2018, 2:22 PMmarcelo
11/05/2018, 2:23 PMasync
??spand
11/05/2018, 2:23 PMmarcelo
11/05/2018, 2:24 PMasync
when I need to return something.nulldev
11/05/2018, 3:36 PMrunBlocking {
renderMetricTimer.tagVal(package).time {
//code
}
}.toSet()