From a8cbb96b3d177985861d3fb7aa1f0492c4f4c842 Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Sun, 15 Dec 2019 03:46:02 +0100 Subject: [PATCH] make that a private instance method instead --- activejob/lib/active_job/callbacks.rb | 5 +++-- activejob/lib/active_job/enqueuing.rb | 2 +- activejob/lib/active_job/execution.rb | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/activejob/lib/active_job/callbacks.rb b/activejob/lib/active_job/callbacks.rb index b2bf4c98d7e..ad6051f7b1a 100644 --- a/activejob/lib/active_job/callbacks.rb +++ b/activejob/lib/active_job/callbacks.rb @@ -163,9 +163,11 @@ module ActiveJob def around_enqueue(*filters, &blk) set_callback(:enqueue, :around, *filters, &blk) end + end + private def warn_against_after_callbacks_execution_deprecation(callbacks) # :nodoc: - if !skip_after_callbacks_if_terminated && callbacks.any? { |c| c.kind == :after } + if !self.class.skip_after_callbacks_if_terminated && callbacks.any? { |c| c.kind == :after } ActiveSupport::Deprecation.warn(<<~EOM) In Rails 6.2, `after_enqueue`/`after_perform` callbacks no longer run if `before_enqueue`/`before_perform` respectively halts with `throw :abort`. To enable this behavior, uncomment the `config.active_job.skip_after_callbacks_if_terminated` config @@ -173,6 +175,5 @@ module ActiveJob EOM end end - end end end diff --git a/activejob/lib/active_job/enqueuing.rb b/activejob/lib/active_job/enqueuing.rb index ba577ab4ea4..7e867ae945b 100644 --- a/activejob/lib/active_job/enqueuing.rb +++ b/activejob/lib/active_job/enqueuing.rb @@ -63,7 +63,7 @@ module ActiveJob if successfully_enqueued self else - self.class.warn_against_after_callbacks_execution_deprecation(_enqueue_callbacks) + warn_against_after_callbacks_execution_deprecation(_enqueue_callbacks) if self.class.return_false_on_aborted_enqueue false diff --git a/activejob/lib/active_job/execution.rb b/activejob/lib/active_job/execution.rb index 3ac0b707691..545a54efb46 100644 --- a/activejob/lib/active_job/execution.rb +++ b/activejob/lib/active_job/execution.rb @@ -42,7 +42,7 @@ module ActiveJob successfully_performed = true end - self.class.warn_against_after_callbacks_execution_deprecation(_perform_callbacks) unless successfully_performed + warn_against_after_callbacks_execution_deprecation(_perform_callbacks) unless successfully_performed successfully_performed rescue => exception rescue_with_handler(exception) || raise