mirror of
https://github.com/immich-app/immich.git
synced 2025-12-05 20:40:29 -08:00
review changes
This commit is contained in:
@@ -4,7 +4,6 @@ import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
fun <T> dispatch(
|
||||
dispatcher: CoroutineDispatcher = Dispatchers.IO,
|
||||
@@ -12,9 +11,6 @@ fun <T> dispatch(
|
||||
block: () -> T
|
||||
) {
|
||||
CoroutineScope(dispatcher).launch {
|
||||
val result = runCatching { block() }
|
||||
withContext(Dispatchers.Main) {
|
||||
callback(result)
|
||||
}
|
||||
callback(runCatching { block() })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,6 @@ func dispatch<T>(
|
||||
block: @escaping () throws -> T
|
||||
) {
|
||||
DispatchQueue.global(qos: qos).async {
|
||||
let result = Result { try block() }
|
||||
DispatchQueue.main.async {
|
||||
completion(result)
|
||||
}
|
||||
completion(Result { try block() })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user