mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Fix cancelling jobs
A request to cancel a job was not processed correctly. The cancelling routine of a task must run, regardless of the (non-final) state. Now it works like this: if a job is currently running, it is interrupted and its cancel routine is invoked. It then enters "cancelled" state. If it is stuck, it is loaded and only its cancel routine is run. If it is in a final state or waiting, it is removed from the queue.
This commit is contained in:
@ -20,7 +20,7 @@ object JobState {
|
||||
/** Is currently executing */
|
||||
case object Running extends JobState {}
|
||||
|
||||
/** Finished with failure and is being retried. */
|
||||
/** Task completed with failure and is being retried. */
|
||||
case object Stuck extends JobState {}
|
||||
|
||||
/** Finished finally with a failure */
|
||||
@ -34,8 +34,9 @@ object JobState {
|
||||
|
||||
val all: Set[JobState] =
|
||||
Set(Waiting, Scheduled, Running, Stuck, Failed, Cancelled, Success)
|
||||
val queued: Set[JobState] = Set(Waiting, Scheduled, Stuck)
|
||||
val done: Set[JobState] = Set(Failed, Cancelled, Success)
|
||||
val queued: Set[JobState] = Set(Waiting, Scheduled, Stuck)
|
||||
val done: Set[JobState] = Set(Failed, Cancelled, Success)
|
||||
val inProgress: Set[JobState] = Set(Scheduled, Running, Stuck)
|
||||
|
||||
def parse(str: String): Either[String, JobState] =
|
||||
str.toLowerCase match {
|
||||
|
Reference in New Issue
Block a user