fix: explosion cuts off randomly

This commit is contained in:
minjaesong
2024-02-17 00:30:04 +09:00
parent ffd470f2b4
commit 9caf9ab2fa
12 changed files with 110 additions and 41 deletions

View File

@@ -54,14 +54,14 @@ object ExplosionManager {
Thread {
while (true) {
try {
val job = runners.first { !it.executed }
val executor = Executors.newSingleThreadExecutor()
executor.submit(job.runner).get(500L, TimeUnit.MILLISECONDS)
executor.shutdownNow()
job.executed = true
runners.toList().firstOrNull { !it.executed }?.let { job ->
val executor = Executors.newSingleThreadExecutor()
executor.submit(job.runner).get(500L, TimeUnit.MILLISECONDS)
executor.shutdownNow()
job.executed = true
}
}
catch (_: TimeoutException) { }
catch (_: NoSuchElementException) { }
Thread.sleep(50L)
}