File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,13 @@ def already_supported_by_sentry_integration?
1717 Sentry . configuration . rails . skippable_job_adapters . include? ( self . class . queue_adapter . class . to_s )
1818 end
1919
20+ def retry_job ( error :, **opts )
21+ unless Sentry . configuration . rails . active_job_report_after_job_retries
22+ SentryReporter . capture_exception ( self , error )
23+ end
24+ super
25+ end
26+
2027 class SentryReporter
2128 OP_NAME = "queue.active_job"
2229 SPAN_ORIGIN = "auto.queue.active_job"
Original file line number Diff line number Diff line change @@ -446,9 +446,11 @@ def perform(event, hint)
446446 allow ( Sentry ::Rails ::ActiveJobExtensions ::SentryReporter )
447447 . to receive ( :capture_exception ) . and_call_original
448448
449- assert_performed_jobs 3 do
450- FailedJobWithRetryOn . perform_later rescue nil
451- end
449+ FailedJobWithRetryOn . perform_later rescue nil
450+
451+ perform_enqueued_jobs
452+ perform_enqueued_jobs
453+ perform_enqueued_jobs rescue nil
452454
453455 expect ( Sentry ::Rails ::ActiveJobExtensions ::SentryReporter )
454456 . to have_received ( :capture_exception )
@@ -469,9 +471,11 @@ def perform(event, hint)
469471 allow ( Sentry ::Rails ::ActiveJobExtensions ::SentryReporter )
470472 . to receive ( :capture_exception ) . and_call_original
471473
472- assert_performed_jobs 3 do
473- FailedJobWithRetryOn . perform_later rescue nil
474- end
474+ FailedJobWithRetryOn . perform_later rescue nil
475+
476+ perform_enqueued_jobs
477+ perform_enqueued_jobs
478+ perform_enqueued_jobs rescue nil
475479
476480 expect ( Sentry ::Rails ::ActiveJobExtensions ::SentryReporter )
477481 . to have_received ( :capture_exception )
You can’t perform that action at this time.
0 commit comments