mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-21 09:02:07 -07:00
Change update worker to dedicated thread
This commit is contained in:
parent
629df5adaf
commit
7e30a30192
1 changed files with 9 additions and 3 deletions
|
|
@ -32,9 +32,10 @@ class MajorUpdateWorker {
|
|||
var started = false
|
||||
val sequence = UpdateSequence()
|
||||
val sdf = SimpleDateFormat("HHmmss")
|
||||
fun start() = GlobalScope.launch {
|
||||
val worker = Thread {
|
||||
Thread.currentThread().name = "Major Update Worker"
|
||||
started = true
|
||||
delay(600L)
|
||||
Thread.sleep(600L)
|
||||
while(true){
|
||||
val start = System.currentTimeMillis()
|
||||
val rmlist = ArrayList<Pulse>()
|
||||
|
|
@ -94,7 +95,12 @@ class MajorUpdateWorker {
|
|||
}
|
||||
|
||||
val end = System.currentTimeMillis()
|
||||
delay(max(600 - (end - start), 0))
|
||||
Thread.sleep(max(600 - (end - start), 0))
|
||||
}
|
||||
}
|
||||
fun start() = {
|
||||
if(!started){
|
||||
worker.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue