make that a private instance method instead

This commit is contained in:
Kasper Timm Hansen 2019-12-15 03:46:02 +01:00
parent d258bfe8ac
commit a8cbb96b3d
No known key found for this signature in database
GPG Key ID: 191153215EDA53D8
3 changed files with 5 additions and 4 deletions

@ -163,9 +163,11 @@ def after_enqueue(*filters, &blk)
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 @@ def warn_against_after_callbacks_execution_deprecation(callbacks) # :nodoc:
EOM
end
end
end
end
end

@ -63,7 +63,7 @@ def enqueue(options = {})
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

@ -42,7 +42,7 @@ def perform_now
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