mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 21:07:04 +05:30
fix(core): drop obsolete OptIn and use a named dispatcher
This commit is contained in:
parent
2bc86509cf
commit
2fdbff6f12
1 changed files with 3 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2022-2023 Harsh Shandilya.
|
* Copyright © 2022-2024 Harsh Shandilya.
|
||||||
* Use of this source code is governed by an MIT-style
|
* Use of this source code is governed by an MIT-style
|
||||||
* license that can be found in the LICENSE file or at
|
* license that can be found in the LICENSE file or at
|
||||||
* https://opensource.org/licenses/MIT.
|
* https://opensource.org/licenses/MIT.
|
||||||
|
@ -11,10 +11,8 @@ package dev.msfjarvis.claw.core.coroutines
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlinx.coroutines.CoroutineDispatcher
|
import kotlinx.coroutines.CoroutineDispatcher
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|
||||||
|
|
||||||
/** Interface to allow abstracting individual [CoroutineDispatcher]s out of class dependencies. */
|
/** Interface to allow abstracting individual [CoroutineDispatcher]s out of class dependencies. */
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
|
||||||
interface DispatcherProvider {
|
interface DispatcherProvider {
|
||||||
|
|
||||||
fun main(): CoroutineDispatcher = Dispatchers.Main
|
fun main(): CoroutineDispatcher = Dispatchers.Main
|
||||||
|
@ -23,7 +21,8 @@ interface DispatcherProvider {
|
||||||
|
|
||||||
fun io(): CoroutineDispatcher = Dispatchers.IO
|
fun io(): CoroutineDispatcher = Dispatchers.IO
|
||||||
|
|
||||||
fun database(): CoroutineDispatcher = Dispatchers.IO.limitedParallelism(1)
|
fun database(): CoroutineDispatcher =
|
||||||
|
Dispatchers.IO.limitedParallelism(1, name = "DatabaseDispatcher")
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Concrete type for [DispatcherProvider] with all the defaults from the class. */
|
/** Concrete type for [DispatcherProvider] with all the defaults from the class. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue