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?
17
17
Sentry . configuration . rails . skippable_job_adapters . include? ( self . class . queue_adapter . class . to_s )
18
18
end
19
19
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
+
20
27
class SentryReporter
21
28
OP_NAME = "queue.active_job"
22
29
SPAN_ORIGIN = "auto.queue.active_job"
Original file line number Diff line number Diff line change @@ -440,9 +440,11 @@ def perform(event, hint)
440
440
allow ( Sentry ::Rails ::ActiveJobExtensions ::SentryReporter )
441
441
. to receive ( :capture_exception ) . and_call_original
442
442
443
- assert_performed_jobs 3 do
444
- FailedJobWithRetryOn . perform_later rescue nil
445
- end
443
+ FailedJobWithRetryOn . perform_later rescue nil
444
+
445
+ perform_enqueued_jobs
446
+ perform_enqueued_jobs
447
+ perform_enqueued_jobs rescue nil
446
448
447
449
expect ( Sentry ::Rails ::ActiveJobExtensions ::SentryReporter )
448
450
. to have_received ( :capture_exception )
@@ -463,9 +465,11 @@ def perform(event, hint)
463
465
allow ( Sentry ::Rails ::ActiveJobExtensions ::SentryReporter )
464
466
. to receive ( :capture_exception ) . and_call_original
465
467
466
- assert_performed_jobs 3 do
467
- FailedJobWithRetryOn . perform_later rescue nil
468
- end
468
+ FailedJobWithRetryOn . perform_later rescue nil
469
+
470
+ perform_enqueued_jobs
471
+ perform_enqueued_jobs
472
+ perform_enqueued_jobs rescue nil
469
473
470
474
expect ( Sentry ::Rails ::ActiveJobExtensions ::SentryReporter )
471
475
. to have_received ( :capture_exception )
You can’t perform that action at this time.
0 commit comments