Use Default dispatcher instead of IO

pull/1061/head
Alex Baker 4 years ago
parent da256f2293
commit aa9e0e93b9

@ -14,7 +14,6 @@ import dagger.hilt.android.HiltAndroidApp
import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.tasks.billing.BillingClient import org.tasks.billing.BillingClient
import org.tasks.billing.Inventory import org.tasks.billing.Inventory
@ -72,7 +71,7 @@ class Tasks : Application(), Configuration.Provider {
} }
} }
private fun backgroundWork() = CoroutineScope(Dispatchers.IO + SupervisorJob()).launch { private fun backgroundWork() = CoroutineScope(Dispatchers.Default).launch {
NotificationSchedulerIntentService.enqueueWork(context, false) NotificationSchedulerIntentService.enqueueWork(context, false)
CalendarNotificationIntentService.enqueueWork(context) CalendarNotificationIntentService.enqueueWork(context)
refreshScheduler.get().scheduleAll() refreshScheduler.get().scheduleAll()

@ -22,7 +22,7 @@ import javax.inject.Inject
@AndroidEntryPoint @AndroidEntryPoint
class DashClockExtension : DashClockExtension() { class DashClockExtension : DashClockExtension() {
private val job = SupervisorJob() private val job = SupervisorJob()
private val scope = CoroutineScope(Dispatchers.IO + job) private val scope = CoroutineScope(Dispatchers.Default + job)
@Inject lateinit var defaultFilterProvider: DefaultFilterProvider @Inject lateinit var defaultFilterProvider: DefaultFilterProvider
@Inject lateinit var taskDao: TaskDao @Inject lateinit var taskDao: TaskDao
@ -43,6 +43,7 @@ class DashClockExtension : DashClockExtension() {
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
localBroadcastManager.unregisterReceiver(refreshReceiver) localBroadcastManager.unregisterReceiver(refreshReceiver)
job.cancel()
} }
override fun onUpdateData(i: Int) { override fun onUpdateData(i: Int) {

@ -15,7 +15,7 @@ import javax.inject.Inject
abstract class InjectingService : Service() { abstract class InjectingService : Service() {
private val job = SupervisorJob() private val job = SupervisorJob()
private val scope = CoroutineScope(Dispatchers.IO + job) private val scope = CoroutineScope(Dispatchers.Default + job)
@Inject lateinit var firebase: Firebase @Inject lateinit var firebase: Firebase

Loading…
Cancel
Save