Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging Cancel/Remove into DeleteJobs and making it clean up job fully (
#286) * Merging Cancel/Remove into DeleteJobs and making it clean up job fully Cancel and Remove were doing the same thing with subtle differences Now there is just one RemoveJobs, which deletes all information from the database about the job - If the job doesn't exist or nothing was deleted, it won't be in the returned - If some information was deleted for the job, it will be returned with the value of nil - If an error occurred while deleting, it will be returned with a value of the err message * Setting job object to expire after 7 days rather than delete immediately As we currently don't have a good story for debugging previously jobs (although all information is in events) We will leave the job object around for a short while, so we can look at it if needed before it disappears forever * Indicating the job was cancelled, on expiry being reset * Returning error from ReportDone if any jobs failed to be deleted * Not resetting expiry when deleting job, if expiry already set * Removing JobIdentities and using Job instead We are using JobIdentities as an optimization to load less data However it is used in only 1 place and likely it doesn't bring a huge benefit for the complexity it brings - Added maintenance of multiple ways of loading For now I am removing it to simplify the code and not need to fix it to handle missing jobs - When jobs are deleted, they are deleted from the queue index, which breaks this way of loading data * Removing JobQueue redis index as it is no longer used * Changing GetJobsByIds to GetExistingJobsByIds The function no longer errors when a job id is not present. As we now delete jobs as they finish, the jobs can no longer be assumed to live forever: - So now we just return the jobs we find - Return error if we failed to load and it wasn't due to job missing * Fixing accidental negation * Fix ineffectual assignment Co-authored-by: jankaspar <2270833+jankaspar@users.noreply.github.com>
- Loading branch information