ribesg
03/19/2020, 11:30 AMribesg
03/19/2020, 11:30 AMribesg
03/19/2020, 11:32 AMribesg
03/19/2020, 11:35 AMexecuteJobs()
does nothing (basically a forEach
on a Stately sharedMutableList()
which is empty most of the time)ribesg
03/19/2020, 11:36 AMbasher
03/19/2020, 4:13 PMbasher
03/19/2020, 4:15 PMribesg
03/20/2020, 8:31 AMprivate fun executeJobs() {
if (queue.isEmpty()) return
val jobs = queue.toList()
jobs.forEach { job ->
when (job) {
is WriteJob -> {
try {
job.file.writeRaw(job.content, create = true, createParents = true)
} catch (t: Throwable) {
log.error("Failed to write file ${job.file}: ${t.message}", t)
}
}
is DeleteJob -> {
try {
job.file.delete()
} catch (t: Throwable) {
log.error("Failed to delete file ${job.file}: ${t.message}", t)
}
}
}
}
queue.removeAll(jobs)
}
ribesg
03/20/2020, 8:35 AMCoroutineWorker.execute
per instance which would run an infinite loop waiting on a shared collection, but CoroutineWorker is hardcoded to 4 threads and I need more than 4 and it was deadlocking somehow (I thought that using delay
would allow a different execute block to continue execution but it didn’t work)ribesg
03/20/2020, 8:35 AMbasher
03/20/2020, 3:03 PMbasher
03/20/2020, 3:04 PMbasher
03/20/2020, 3:04 PMribesg
03/20/2020, 3:54 PMbasher
03/20/2020, 4:03 PMribesg
03/20/2020, 4:06 PM