You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the Rails docs, this after_discard block is meant to re-raise the exception, but from my testing it doesn't. If the after_discard block doesn't raise the exception, the exception is not automatically re-raised, and so Shoryuken thinks everything is OK, and the message doesn't DLQ.
I've fixed this by hooking into the ActiveSupport::Notification active_job.retry_stopped event, and re-raising the exception there.
# frozen_string_literal: true# This class exists to circumvent ActiveJob not re-raising exceptions in the retry_on block.# When those exceptions are not re-raised, the error is not bubbled up to Shoryuken, which means the message does not get DLQ'd.#moduleEventSubscribersclassActiveJobSubscriberdefcall(*args)event=ActiveSupport::Notifications::Event.new(*args)raiseevent.payload[:error]ifevent.name == "retry_stopped.active_job"endendend
This issue is to mainly ask if this is indeed correct, should we be re-raising to Shoryuken for it to DLQ, and if not, how should I handle this?
I also assume the Rails code is broken, as it is not automatically re-raising the error for me, which is obviously not something to be handled by this gem, but it seems to be the current state of affairs (having checked Rails main, no changes there yet, I'll probably open an issue).
The text was updated successfully, but these errors were encountered:
After we upgraded our app to Rails 7.1.3, we noticed that errors were no longer going to our configured DLQs.
We had our set up following the recommended setup, from this comment: #553 (comment)
In our
ApplicationJob
class we have the following, but we were never seeing any raised exceptions go to the DLQ.After a lot of digging into ActiveJob, I found this change: https://github.com/rails/rails/pull/48010/files
The relevant part of it is here: https://github.com/rails/rails/pull/48010/files#diff-c017408d8f8e9b0a914da28fdcebc291c5fba624174fb9ca5bec3b4fc1c61d51
According to the Rails docs, this
after_discard
block is meant to re-raise the exception, but from my testing it doesn't. If theafter_discard
block doesn't raise the exception, the exception is not automatically re-raised, and so Shoryuken thinks everything is OK, and the message doesn't DLQ.I've fixed this by hooking into the ActiveSupport::Notification
active_job.retry_stopped
event, and re-raising the exception there.This issue is to mainly ask if this is indeed correct, should we be re-raising to Shoryuken for it to DLQ, and if not, how should I handle this?
I also assume the Rails code is broken, as it is not automatically re-raising the error for me, which is obviously not something to be handled by this gem, but it seems to be the current state of affairs (having checked Rails main, no changes there yet, I'll probably open an issue).
The text was updated successfully, but these errors were encountered: