Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add more attempts in a job #1242

Open
jquequezana opened this issue May 2, 2020 · 2 comments
Open

How to add more attempts in a job #1242

jquequezana opened this issue May 2, 2020 · 2 comments

Comments

@jquequezana
Copy link

Hello, maybe someone can help me with that questions ...
Would like to know how can add more attempts to a job based on the flow

First I create my job with 3 attempts....
After... the work fail 2 times but based on some event I need to add 1 attempt more to my job.

My question is how to get the current max attempts and add x more attempts, that is because if the event happens again need add 1 attempt more

Second question is how to fail a job with no more attempts;

Regards

@jquequezana
Copy link
Author

jquequezana commented May 2, 2020

I think I found the solution to my second question is ok ?

61 job.attempts(0).save();
62 done(new Error('not found'));

@jquequezana
Copy link
Author

jquequezana commented May 2, 2020

About my first question What is the correct way to do that?
A.

job._max_attempts++;
job.set('max_attempts', job._max_attempts);

B.

job.attempts(++job._max_attempts).save();

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant