use ProxyPattern to match for ActiveSupport::Notifications fanout/unsubscribe#32861
use ProxyPattern to match for ActiveSupport::Notifications fanout/unsubscribe#32861tenderlove merged 1 commit intorails:masterfrom
Conversation
|
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review. Please see the contribution instructions for more information. |
8392172 to
5c9279b
Compare
5c9279b to
388cb66
Compare
|
Looks like there might have been some CodeClimate concerns but the analysis is out of date - can you merge in latest master so we can get an up to date build? |
388cb66 to
2c01532
Compare
|
@oniofchaos I think there was an issue in master when the previous build ran. I rebased on latest master; everything looks green now! |
b502722 to
fee6548
Compare
|
@jhawthorn you've looked at this code recently. Any opinions? |
There was a problem hiding this comment.
Can we use Set#include? instead? Since we know name and everything in the set to be a string
There was a problem hiding this comment.
Can you change blacklist! to "restricted_list" or maybe restrict!.
jhawthorn
left a comment
There was a problem hiding this comment.
Other than two comments this looks good to me.
fee6548 to
94f8e8c
Compare
|
Thanks @jhawthorn and @tenderlove. I've implemented your suggested changes. |
Great! Thank you! |
|
I'll merge this once CI returns. 😄 |
Summary
Before this change,
ActiveSupport::Notifications.unsubscribewould eagerly remove all subscribers for whichsubscriber.matches?(string)was true, which can cause some unintended behavior in the case of regexes or other compound matchers (in our case, we had a single listener subscribed to a few dozen event keys via a single pattern object that internally checked for inclusion within a set).Unsubscribing to a single string should not negate any other potential matches for those subscriptions. After this change:
listeners_formap.