-
Notifications
You must be signed in to change notification settings - Fork 174
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
feat: add a way to limit the number of subscriptions per connection #739
Conversation
core/src/server/helpers.rs
Outdated
/// Wrapper over [`tokio::sync::Notify`] with bounds check. | ||
#[derive(Debug)] | ||
pub struct BoundedSubscriptions { | ||
inner: Arc<Notify>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering whether we need the Arc
here? What would happen if we ditched it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, we use it to count notifies too; I see!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Would be good to have an integration test that it works :)
Point to Tokio 1.16 (we use a method from it), and a little special treatment for unsubscribe methods
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
Closing #729