I have a few functions that do some database stuff...
# announcements
w
I have a few functions that do some database stuff. Of course I want to run them async, how should I do it? Add the suspend keyword to the function and then call the functions with an async block?
e
Please, join #C1CFAFJSK for discussion. Assuming that you don’t have access to async DB driver (your DB invocations block at thread) you can consider this kind of solution: https://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/coroutines-guide-ui.md#blocking-operations
Or you can use it from coroutines as-it (without suspend keyword) if you don’t mind your thread to be blocked
👍 1