level-jobs
level-jobs copied to clipboard
pattern for deleting a failed job?
was trying to use it to delete a failed job after a maxretry, with the event "error" I can retrieve the error message but not the jobId. What would be the recommended way to delete something once it's errored?
I think the job should be deleted from the pending db once the maximum number of retries is reached. https://github.com/pgte/level-jobs/blob/master/server.js#L158
Right now, the queue only emits an error. We could augment the error with the payload. Will accept PR with this feature.
I also have the problem of jobs still failing after maxRetries trials which are crashing my node.js process!! I don't really understand the logic^^, since this is blocking the whole queue which could be potentially catastrophic for some applications... Please write a warning in the documentation page about such behavior. Would it be possible to add an option or indicate a way to properly just throw a warning (and not an error) in such a case (maxRetries reached) please?
I am also in favor of manishbhatias solution above of deleting the job instead of throwing an error: https://github.com/pgte/level-jobs/blob/master/server.js#L158 What would be the proper way to do that please ?
Thanks a lot in advance, and thanks for this nice package