开发者

Delayed_job custom failing assertions?

开发者 https://www.devze.com 2023-01-05 19:10 出处:网络
I\'m using delayed_job for a priority queue. I was wondering how do i define what a failed job is? Thanks.开发者_运维百科A failed job is a job that raises an error.If you want the job to fail you can

I'm using delayed_job for a priority queue. I was wondering how do i define what a failed job is?

Thanks.开发者_运维百科


A failed job is a job that raises an error. If you want the job to fail you can simply raise an error. Sometimes, if I am waiting on something else to finish, instead of failing the job I will put another job in the queue with a run_at for x time in the future.


Failed jobs are deleted by default, just like successful ones. However, you can configure delayed_job to keep them, in which case the failed_at column will be populated with the time of the last failure. Then you simply check if failed_at is nil or not. With the default behaviour, I haven't found a way to tell a successful job from a failed one.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号