Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler way to remove all log subscribers. #372

Open
ioquatix opened this issue Aug 2, 2023 · 3 comments
Open

Simpler way to remove all log subscribers. #372

ioquatix opened this issue Aug 2, 2023 · 3 comments

Comments

@ioquatix
Copy link

ioquatix commented Aug 2, 2023

Not sure if this has been considered, but what about:

ActiveSupport::Notifications.notifier = ActiveSupport::Notifications::Fanout.new

This clears out all subscriptions and is probably faster and more robust than the existing implementation.

@benlovell
Copy link
Collaborator

Nice. Thanks for the heads up. Do you want to open a PR or I can pick it up?

@ioquatix
Copy link
Author

I was not planning on opening a PR but I can if that’s helpful.

@owst
Copy link

owst commented Jan 24, 2024

I agree that the existing implementation isn't particularly robust (see #386 for example), but wouldn't this also unsubscribe unrelated listeners, for example the one powering a gem such as https://github.com/steventen/sql_tracker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants