Skip to content

Instantly share code, notes, and snippets.

@stevelounsbury
Created June 15, 2016 15:57
Show Gist options
  • Select an option

  • Save stevelounsbury/0cb160b9e3b47b18383882206f9836e4 to your computer and use it in GitHub Desktop.

Select an option

Save stevelounsbury/0cb160b9e3b47b18383882206f9836e4 to your computer and use it in GitHub Desktop.
Unsubscribing ActiveJob::Logging::LogSubscriber
def remove_aj_subscribers
patterns = ActiveSupport::Subscriber.subscribers.detect { |s| s.is_a? ActiveJob::Logging::LogSubscriber }.patterns
subscribers = patterns.map { |p| ActiveSupport::Notifications.notifier.listeners_for(p) }.flatten
subscribers.each do |subscriber|
ActiveSupport::Notifications.notifier.unsubscribe(subscriber)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment