Fix bugs in TrafficRecorder

Addresses #220.
This commit is contained in:
Mygod
2021-08-22 00:38:11 -04:00
parent a15e9d303e
commit b52d0e8240

View File

@@ -130,6 +130,7 @@ object TrafficRecorder {
}
fun update(timeout: Boolean = false) {
synchronized(this) {
unscheduleUpdateLocked()
if (records.isEmpty()) return
val timestamp = System.currentTimeMillis()
if (!timeout && timestamp - lastUpdate <= 100) return
@@ -141,7 +142,6 @@ object TrafficRecorder {
SmartSnackbar.make(e).show()
}
lastUpdate = timestamp
updateJob = null
scheduleUpdateLocked()
}
}