diff --git a/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt b/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt index bedfce79a..6552aa6ac 100644 --- a/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt +++ b/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt @@ -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() @@ -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() } } } \ No newline at end of file