-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
ActiveJob with retry_on— retries indefinitely despite "attempts" option #553
Comments
Hi @alexford
For SQS, I believe that |
Thanks for the quick reply, @phstc. Looking now I see that some of the built-in adapters support this, and some do not: https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html I notice that with With |
There is a good workaround, though: retry_on RetryableError, attempts: 2 do |_job, exception|
Raven.capture_exception(exception) # for example, if using Sentry, or log however you want
end |
@alexford that's a great solution - thanks for sharing it. The auto delete enabled in the AJ adapter, does not delete the message if the worker raises an error.
A couple of options to make a) (what you suggested)retry_on ErrorYourPerformMayRaise, attempts: N do |_job, _exception|
# Log error, etc.
# Do not raise the error up, otherwise, Shoryuken will not auto-delete the message
# Must implement this block, otherwise,
# Active Job will re-raise errors and Shoryuken won't delete the messages
end b)retry_on ErrorYourPerformMayRaise, attempts: N
rescue_from ActiveJob::DeserializationError do |_exception|
# Log error, etc.
# Do not raise the error up, otherwise, Shoryuken will not auto-delete the message
# Must implement this block, otherwise,
# Active Job will re-raise errors and Shoryuken won't delete the messages
end c)retry_on ErrorYourPerformMayRaise, attempts: N
discard_on ActiveJob::DeserializationError d)Configure a Dead Letter queue with Updated wiki: https://github.com/phstc/shoryuken/wiki/Rails-Integration-Active-Job#how-to-use-retry_on. |
Hi, a) is not working for me. I configured my Dead Letter queue accordingly and set the
|
Hi @jmammen You should use this ✅ retry_on MyException1, MyException2, attempts: 3 do |_job, _exception|
# Log error, etc.
# Do not raise the error up, otherwise, Shoryuken will not auto-delete the message
# Must implement this block, otherwise,
# Active Job will re-raise errors and Shoryuken won't delete the messages
end Instead of just 🚫 retry_on MyException1, MyException2, attempts: 3 Otherwise, Active Job will re-raise errors and Shoryuken won't delete the messages. As pointed out by @alexford.
|
Given the following ActiveJob class in Rails 5.2.2:
I would expect the job to run in Shoryuken only twice, but it runs indefinitely, repeating at each
visibility_timeout
period. I am seeing this in the logs from ActiveJob, but the message remains in SQS:discard_on
works as expected—the job is only run once.Is there some bit of configuration I'm missing here, or is this not expected to work?
ActiveJob's docs for
retry_on
: https://api.rubyonrails.org/v5.2.2/classes/ActiveJob/Exceptions/ClassMethods.html#method-i-retry_onThe text was updated successfully, but these errors were encountered: