Moves all Dispatchers.Default to IO because of the amount of Synchronized code that blocks the thread underneath each coroutine and since Default only has the exact number of threads the processor offers, once they block, we lose computing power

This commit is contained in:
Vitor Pamplona
2025-10-21 18:30:08 -04:00
parent d8907e3dfb
commit df54f7bb67
112 changed files with 231 additions and 231 deletions
@@ -40,7 +40,7 @@ import java.util.concurrent.atomic.AtomicBoolean
@Stable
class BundledUpdate(
val delay: Long,
val dispatcher: CoroutineDispatcher = Dispatchers.Default,
val dispatcher: CoroutineDispatcher = Dispatchers.IO,
) {
// Exists to avoid exceptions stopping the coroutine
val exceptionHandler =
@@ -66,7 +66,7 @@ class BundledUpdate(
@Stable
class BasicBundledUpdate(
val delay: Long,
val dispatcher: CoroutineDispatcher = Dispatchers.Default,
val dispatcher: CoroutineDispatcher = Dispatchers.IO,
val scope: CoroutineScope,
) {
private var onlyOneInBlock = AtomicBoolean()
@@ -104,7 +104,7 @@ class BasicBundledUpdate(
@Stable
class BundledInsert<T>(
val delay: Long,
val dispatcher: CoroutineDispatcher = Dispatchers.Default,
val dispatcher: CoroutineDispatcher = Dispatchers.IO,
) {
// Exists to avoid exceptions stopping the coroutine
val exceptionHandler =
@@ -130,7 +130,7 @@ class BundledInsert<T>(
@Stable
class BasicBundledInsert<T>(
val delay: Long,
val dispatcher: CoroutineDispatcher = Dispatchers.Default,
val dispatcher: CoroutineDispatcher = Dispatchers.IO,
val scope: CoroutineScope,
) {
private var onlyOneInBlock = AtomicBoolean()