-
-
Notifications
You must be signed in to change notification settings - Fork 438
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
Remove subscriber reference from topic when deleted #1288
Conversation
When subscribers are deleted their subscription key is not removed from the topic they are subscribed to. This should reduce the amount of calls to `$this->cache->get()` to check if the subscriber exists before broadcasting.
When subscribers are deleted their subscription key is not removed from the topic they are subscribed to. This should reduce the amount of calls to `$this->cache->get()` to check if the subscriber exists before broadcasting.
I have been thinking on how to solve this problem to and #1284 solved it a tiny bit, but not really... so when building a Redis optimized version I came up with wrapping the subscriber so we can store it with the topic it subscribed to. https://gist.github.com/stayallive/9b9fe8556faf9c8ba6f09ca54610e40f#file-topicsubscriber-php-L7-L28 This way on deleting the subscriber we can remove the channel from the topic (in my case using This requires wrapping the topic with the subscriber when setting the subscriber info. This might be a good direction to go in to prevent recreating the topic key because that just won't work since a subscription can have a custom topic encoder/decoder. Note: Everything in that gist is experimental and cannot be used until #1286 & #1289 are merged and released otherwise you cannot swap out the subscriber storage class. |
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.
There are some things I think are wrong with this PR and I propose a discussion on how to implement a better way to implement this: #1288 (comment).
Can you merge the latest changes from |
Thanks @stayallive, your suggestions were coming in realtime as I was on the same lines, haha. |
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.
Last little nitpicky comments 😄
@tlaverdure perfect timing, thanks for keeping up with them and integrating them in your PR, this is starting to look real good 😎 |
Co-Authored-By: Alex Bouma <me@alexbouma.me>
Co-Authored-By: Alex Bouma <me@alexbouma.me>
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.
Only the StyleCI fixes left, but after that this looks pretty good to me! 👍
The PR would not have worked as provided, serialization for @tlaverdure @stayallive If you could review the changes, that would be great. Great work so far. |
All good! Thanks for the additions, it makes things a lot clearer. Looks good to me. |
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.
Little nitpick, but other than that this looks good 👍
Changes
When subscribers are deleted their subscription key is not removed from the topic they are subscribed to. This should reduce the amount of calls to
$this->cache->get()
to check if the subscriber exists before broadcasting.Breaking changes
N/A