mirror of
https://github.com/immich-app/immich.git
synced 2026-01-06 20:20:47 -05:00
review changes
This commit is contained in:
parent
0e8492ceba
commit
f632e4f666
@ -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() })
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user