Ensure rescheduleUpdate is ran on bg thread
This commit is contained in:
@@ -229,8 +229,12 @@ class ClientsFragment : Fragment() {
|
||||
super.onStart()
|
||||
// we just put these two thing together as this is the only place we need to use this event for now
|
||||
TrafficRecorder.foregroundListeners[this] = adapter::updateTraffic
|
||||
lifecycleScope.launchWhenStarted {
|
||||
withContext(Dispatchers.Default) {
|
||||
TrafficRecorder.rescheduleUpdate() // next schedule time might be 1 min, force reschedule to <= 1s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
TrafficRecorder.foregroundListeners -= this
|
||||
|
||||
Reference in New Issue
Block a user