mirror of
https://git.asonix.dog/asonix/background-jobs.git
synced 2024-11-21 19:40:59 +00:00
jobs-sled: reorganize completion match
This commit is contained in:
parent
63ee0d7cb7
commit
ad0a295dd1
1 changed files with 11 additions and 13 deletions
|
@ -133,22 +133,20 @@ impl background_jobs_core::Storage for Storage {
|
||||||
};
|
};
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
JobResult::Success => {
|
// successful jobs are removed
|
||||||
// ok
|
JobResult::Success => Ok(true),
|
||||||
Ok(true)
|
// Unregistered or Unexecuted jobs are restored as-is
|
||||||
}
|
|
||||||
JobResult::Unexecuted | JobResult::Unregistered => {
|
JobResult::Unexecuted | JobResult::Unregistered => {
|
||||||
// TODO: handle
|
self.insert(job)?;
|
||||||
Ok(true)
|
Ok(false)
|
||||||
}
|
}
|
||||||
JobResult::Failure => {
|
// retryable failed jobs are restored
|
||||||
if job.prepare_retry() {
|
JobResult::Failure if job.prepare_retry() => {
|
||||||
self.insert(job)?;
|
self.insert(job)?;
|
||||||
Ok(false)
|
Ok(false)
|
||||||
} else {
|
|
||||||
Ok(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// dead jobs are removed
|
||||||
|
JobResult::Failure => Ok(true),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue