Change update worker to dedicated thread
This commit is contained in:
@@ -32,9 +32,10 @@ class MajorUpdateWorker {
|
|||||||
var started = false
|
var started = false
|
||||||
val sequence = UpdateSequence()
|
val sequence = UpdateSequence()
|
||||||
val sdf = SimpleDateFormat("HHmmss")
|
val sdf = SimpleDateFormat("HHmmss")
|
||||||
fun start() = GlobalScope.launch {
|
val worker = Thread {
|
||||||
|
Thread.currentThread().name = "Major Update Worker"
|
||||||
started = true
|
started = true
|
||||||
delay(600L)
|
Thread.sleep(600L)
|
||||||
while(true){
|
while(true){
|
||||||
val start = System.currentTimeMillis()
|
val start = System.currentTimeMillis()
|
||||||
val rmlist = ArrayList<Pulse>()
|
val rmlist = ArrayList<Pulse>()
|
||||||
@@ -94,7 +95,12 @@ class MajorUpdateWorker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val end = System.currentTimeMillis()
|
val end = System.currentTimeMillis()
|
||||||
delay(max(600 - (end - start), 0))
|
Thread.sleep(max(600 - (end - start), 0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun start() = {
|
||||||
|
if(!started){
|
||||||
|
worker.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user