maybe using `async` and `await`?
# coroutines
m
maybe using
async
and
await
?
j
I think
async
is what you need along with
awaitAll
m
thank you Jonathan!
j
Copy code
return pkg.templates.map { renderTemplatePath ->{ 
    async {
       timer.time{
         //...
      }
    }
   }.awaitAll().toSet()
m
checking it out...
j
let me know if that works, I’m still learning too
f
I believe
awaitAll
is also a
suspend
function, so you can only call if from another
suspend
function or lambda.
Why do you want to make
createRenders
async? What blocking operations are you doing inside it?
m
yeah, I'm getting the dreaded "...should be called from another ..." right what @Felix said
I have a
timer
function which does the async inside
gtg - dinner time
n
Why isn't
createRenders
a suspending function?
m
createRenders
is a legacy app that I inherited.