msavin / SteveJobs

A simple jobs queue that just works (for Meteor.js)
Other
207 stars 35 forks source link

Prevent queue from stopping after failure #105

Closed sabativi closed 1 year ago

sabativi commented 1 year ago

Hello, is there any way to prevent the queue from stopping after a certain job failed, I have a generic job which takes some params, and if one failed I do not want to queue to stop.

Thanks

sabativi commented 1 year ago

I think adding { singular: false } should do the trick, all right ?

sabativi commented 1 year ago

@msavin sorry to ping you, but I still have the problem with { singular: false }, do you have any advice on this ?

msavin commented 1 year ago

hey @sabativi if the job failed - it's most likely due to a code error and that should not happen.

you can try this kind of pattern to avoid triggering the queue's error tracking mechanisms:

try {
    // run logic
} catch (e) {
    this.reschedule({...})
}

let me know if you have any other questions

sabativi commented 1 year ago

Thanks @msavin

Yes but what if I want multiple jobs to be able to run in //, can I ?

msavin commented 1 year ago

Yep you can put any logic in between the try / catch statement. Sent from my iPhoneOn Dec 13, 2022, at 12:40 PM, Victor Sabatier @.***> wrote: Thanks @msavin Yes but what if I want multiple jobs to be able to run in //, can I ?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

sabativi commented 1 year ago

Thanks @msavin, I might have not explained my problem properly : here is the jobs_data collection :

Screenshot 2022-12-14 at 09 08 42

One job failed and prevent the following from working whereas they have differents arguments ( but same name ), so I want the jobs to run even if one previous failed

msavin commented 1 year ago

Are you setting the failure state manually?

The failure state is only intended for code failure.

If you are not getting the result you want or need to rerun the job, you need to use this.reschedule()

On Wed, Dec 14, 2022 at 3:15 AM Victor Sabatier @.***> wrote:

I might have not explained my problem properly : here is the jobs_data collection : [image: Screenshot 2022-12-14 at 09 08 42] https://user-images.githubusercontent.com/2357779/207540954-b90de42a-b43d-4493-96b5-01addddbda73.png

One job failed and prevent the following from working whereas they have differents arguments ( but same name ), so I want the jobs to run even if one previous failed

— Reply to this email directly, view it on GitHub https://github.com/msavin/SteveJobs/issues/105#issuecomment-1350603570, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPP5A5NI62NYU2VFRD4O23WNF62XANCNFSM6AAAAAASWUAEXY . You are receiving this because you were mentioned.Message ID: @.***>

sabativi commented 1 year ago

No I am not, I guess an error is thrown and not catch in my code Ok I will use the reschedule function Thanks for yours answers