jobs-sled: reorganize completion match

This commit is contained in:
asonix 2024-01-10 15:06:59 -06:00
parent 63ee0d7cb7
commit ad0a295dd1

View file

@ -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
Ok(true)
}
JobResult::Failure => {
if job.prepare_retry() {
self.insert(job)?; self.insert(job)?;
Ok(false) Ok(false)
} else {
Ok(true)
} }
// retryable failed jobs are restored
JobResult::Failure if job.prepare_retry() => {
self.insert(job)?;
Ok(false)
} }
// dead jobs are removed
JobResult::Failure => Ok(true),
} }
} }
} }