-
Notifications
You must be signed in to change notification settings - Fork 866
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
Delaying failed jobs - fixed delay or exponential backoff + other fixes #227
Conversation
niravmehta
commented
Jul 31, 2013
- Support for delaying failed jobs - with fixed delay for each retry or exponential backoff calculation.
- Way to get all delayed jobs from the queue.
- Fix fo delay() not saving
- Fix for "undefined" showing up via console.error when jobs failed and the error passed was a string
- Honor original delay when retrying failed jobs - instead of processing them right away
…fixes Support for delaying failed jobs - with fixed delay for each retry or exponential backoff calculation. Way to get all delayed jobs from the queue. Fix fo delay() not saving Fix for "undefined" showing up via console.error when jobs failed and the error passed was a string Honor original delay when retrying failed jobs - instead of processing them right away
I am building a HTTP POST catch/store/inspect/forward service and love the flexibility of Kue. But Kue did not delay failed jobs - I found the delay and attempts mechanism was not working per a "user's" expectation. Checked issues here and found a few alternatives. Spent a lot of time over last 5 days fixing the problems. :-) This pull request fixes issues from #126 and adds a few other enhancements. Hope you can merge it into the master soon. BTW, one thing I couldn't fix was that in the UI, a failed-and-delayed job shows up both in failed and delayed list. When it completes eventually, it still shows in failed-and-completed lists. I believe this could be due to some race conditions in state saving. |
BTW, this is how one could use retry mechanism:
or
|
testing this in house and combined with @lukaszfiszer change to worker.js in #197. AWESOME |
Noooope. @niravmehta After some more testing, it seems that delay is being completely ignored. |
@rosskukulinski Can you test it without the job removal code? The "job failed" event fires before the delay handling is processed. And if you want the job to be delayed, you certainly don't want to delete it until all attempts have been made. Also, when you say the delay was ignored, do you mean the original delay you set? Or the retryDelay? The original delay will be used for the first execution of the job. Beyond that point, it will be the retryDelay (fixed or exponential). Let me explain how this works so we are on the same page.
Here are a few pointers on what could be going wrong if the code is not working as expected:
Here's how I debugged problems while I was testing this code:
Hope this helps. And I am happy to solve if you find any bugs! |
Hi @niravmehta, I'll give it another shot today after reviewing your pointers. It should also be noted in giant bold letters if you've changed delay/retryDelay to be in seconds now as opposed to ms. That's a breaking change for any existing code. Thanks again for taking the time to work on this! |
Just to clarify, the delay and retryDelay times in my code are set in ms. Setting them in seconds is a mistake, and that's what I was pointing out. :-) |
Hi, Any idea when this will be merged in? Need the delay feature for something I am working on. |
Is this alive? What are the issues with this? Can it be safely used in production? |
Not completely merged into 0.7.5 yet, but can be done in next update. |
There is another commit doing something similar. Which one looks like it's going to make it into master? (they both have incompatible syntaxes). This this one stable enough? I'm having trouble with the other one. |
I was supposed to define a natural api for this collecting different PRs and user scenarios, but had'nt have enough time to do it, but I will in near feature. |
@israelidanny not sure, but I am currently using this in production, as I need the retry functionality for failed jobs to work. @behrad do you know when this will all be available in Kue? |