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

Add public way to clear subscribers? #17

Closed
matthewmcgarvey opened this issue Jan 4, 2022 · 1 comment · Fixed by #18
Closed

Add public way to clear subscribers? #17

matthewmcgarvey opened this issue Jan 4, 2022 · 1 comment · Fixed by #18

Comments

@matthewmcgarvey
Copy link
Member

I'm working on wrapping specs in transactions. I'm using a Pulsar event to run code whenever a new database connection is created. The problem is that there are situations where I would like to be able to clear all the subscribers:

  • I'll be calling subscribe for every spec and I don't want multiple subscribers so I clear afterwards
  • In situations where I don't want to do the transaction code, I want to clear the subscriber if it exists

Would it make sense to add a public Pulsar::Event.clear to clear any subscribers? Don't know if that's a good name for it (I used clear_subscribers in my code)

Reference: luckyframework/avram#780

@jwoertink
Copy link
Member

I think I needed to do that too at one point, but I forget why. I like clear_subscribers, it reads well.

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

Successfully merging a pull request may close this issue.

2 participants