User service is now non blocking

This commit is contained in:
2020-06-15 20:57:09 +02:00
parent ebd897093c
commit 6688b35a9b
5 changed files with 92 additions and 70 deletions
+5
View File
@@ -6,3 +6,8 @@ import kotlinx.coroutines.*
fun <T> ioAsync(block: suspend CoroutineScope.() -> T): Deferred<T> {
return CoroutineScope(Dispatchers.IO).async(block = block)
}
suspend inline fun <T> launchIo(crossinline block: () -> T): T =
withContext(Dispatchers.IO) {
block()
}