chore: better handling of coroutine dispatchers.
All checks were successful
Check PR code / BuildAndTestAndCoverage (pull_request) Successful in 30m26s

This commit is contained in:
2025-03-25 00:13:30 +01:00
parent 7c65a63315
commit 1b2e9edc8c
10 changed files with 171 additions and 134 deletions

View File

@ -334,7 +334,7 @@ class Repository(
_badgeUnread.value -= 1
}
CoroutineScope(Dispatchers.Main).launch {
CoroutineScope(Dispatchers.Default).launch {
updateDBItem(item)
}
}
@ -345,7 +345,7 @@ class Repository(
_badgeUnread.value += 1
}
CoroutineScope(Dispatchers.Main).launch {
CoroutineScope(Dispatchers.Default).launch {
updateDBItem(item)
}
}
@ -356,7 +356,7 @@ class Repository(
_badgeStarred.value += 1
}
CoroutineScope(Dispatchers.Main).launch {
CoroutineScope(Dispatchers.Default).launch {
updateDBItem(item)
}
}
@ -367,7 +367,7 @@ class Repository(
_badgeStarred.value -= 1
}
CoroutineScope(Dispatchers.Main).launch {
CoroutineScope(Dispatchers.Default).launch {
updateDBItem(item)
}
}

View File

@ -82,7 +82,7 @@ class SelfossApi(
}
modifyRequest {
Napier.i("Will modify", tag = "HttpSend")
CoroutineScope(Dispatchers.Main).launch {
CoroutineScope(Dispatchers.IO).launch {
Napier.i("Will login", tag = "HttpSend")
login()
Napier.i("Did login", tag = "HttpSend")

View File

@ -16,7 +16,7 @@ class ConnectivityService {
fun start() {
connectivity = Connectivity()
connectivity.start()
CoroutineScope(Dispatchers.Main).launch {
CoroutineScope(Dispatchers.Default).launch {
connectivity.statusUpdates.collect { status ->
when (status) {
is Connectivity.Status.Connected -> {