https://kotlinlang.org logo
#coroutines
Title
# coroutines
t

Timo Gruen

07/15/2021, 10:06 AM
Hi Folks, I’m currently running into an issue while bootstrapping my application. While initializing an object, I would like to create indices in my mongodb collection. When using the following snippet:
Copy code
runBlocking {
            collection.createIndexes(indexes)
}
I keep get issues because the
awaitSingle()
(which is inside the
createIndexes(...)
) is being stopped, and no value is being returned. Any help there?
n

Nick Allen

07/16/2021, 3:24 PM
Are you perhaps running this code on a thread used for coroutine dispatch. runBlocking can prevent other coroutines from running because, well, it's blocking.
5 Views