forked from 2009Scape/Server
Change update worker to dedicated thread
This commit is contained in:
parent
eb2517ef3e
commit
1f8073354d
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