Skip to content

Commit

Permalink
💩: remove meaningless coroutine context switching
Browse files Browse the repository at this point in the history
  • Loading branch information
junerver committed Mar 14, 2024
1 parent d581e33 commit 86ff7b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fun Manual() {
*/
request()
}
TButton(text = "request with params") {
TButton(text = "request with error params") {
request("unknow", "unknow")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import java.io.Serializable
import kotlin.properties.Delegates
import kotlin.reflect.KFunction
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.async
Expand Down Expand Up @@ -191,7 +190,7 @@ class Fetch<TData : Any>(private val options: RequestOptions<TData> = defaultOpt
* 使用自身作用域的同步请求函数
*/
override fun _run(params: TParams) {
this.scope.launch(Dispatchers.IO + SupervisorJob()) {
this.scope.launch {
_runAsync(params)
}.also { requestJobs.add(it) }
}
Expand Down

0 comments on commit 86ff7b2

Please sign in to comment.