Report rescued recurring enqueue errors to Rails.error#756
Open
rafael-pissardo wants to merge 6 commits into
Open
Report rescued recurring enqueue errors to Rails.error#756rafael-pissardo wants to merge 6 commits into
rafael-pissardo wants to merge 6 commits into
Conversation
RecurringTask#enqueue was swallowing Job::EnqueueError (and other-adapter enqueue failures) without calling Rails.error.report, so production outages like a read-only primary during failover only produced log lines and missed Sentry Issues. Align with the gem's on_thread_error default. Fixes rails#746
rafael-pissardo
force-pushed
the
fix/report-recurring-enqueue-errors-to-rails-error
branch
2 times, most recently
from
July 17, 2026 19:04
115d470 to
34098d7
Compare
The forked lifecycle test already waits up to shutdown_timeout for the supervisor PID to exit after repeated TERM signals. The async counterpart only slept for 1s, which is flaky under load (e.g. Ruby 4 + rails_main + MySQL).
wait_for_jobs_to_finish_for waits on finished_at, which failed jobs never set, so the test always timed out. Wait for FailedExecution records instead and stop the worker before asserting to avoid races with in-flight threads.
Setup only waited 0.5s for processes to register, and a few scenarios used tight pause windows that flake under MySQL CI load. Widen registration and job-completion waits, and leave more margin so C still finishes last in the throttled sequence test.
Wait for supervisor teardown to deregister processes, adopt the claimed- release wait from rails#734, and scope recurring JobResult assertions to the custom_status rows this test creates so leftover StoreResultJob rows cannot fail the suite.
Forked StoreResultJob workers from earlier tests can still write after teardown and overwrite a JobResult whose id was reused, turning status into "completed". Clear processes/records before creating @Result, wait for claimed slots before enqueueing blocked jobs, and tighten discard setup timing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RecurringTask#enqueuerescuesJob::EnqueueError(or an other-adapter enqueue failure), report the exception viaRails.error.reportso error subscribers (Sentry, etc.) see it.handled: true) and notification payload shape.Fixes #746
Test plan
bin/rails test test/models/solid_queue/recurring_task_test.rbRails.errorsubscriber) receives the original exception object with cause/backtrace during a simulated enqueue failureMade with Cursor