Skip to content

ActiveJob missing error reporting on retriesΒ #2597

@solnic

Description

@solnic

As described here hooking into perform_now is not enough to capture all exceptions that happen during execution of a job because retry logic is implemented as a rescue handler, which simply bypasses entire code flow from the perform_now.

It turned out we need to patch retry_job in order to be able to report exceptions on each retry but this is needed only up until Rails 8.0.2 (included). Luckily latest Rails' version of ActiveJob uses ActiveSupport.error.reporter to report an exception before retrying a job, which means we can provide our own error subscriber and no patching will be needed for Rails > 8.0.2 (not released in the moment of writing this but it's in main).

It turned out there's enqueue_retry.active_job that we can simply rely on for this.

Metadata

Metadata

Assignees

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions