-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Refactor notifiers #725
base: master
Are you sure you want to change the base?
Refactor notifiers #725
Conversation
CodSpeed Performance ReportMerging #725 will not alter performanceComparing Summary
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #725 +/- ##
==========================================
- Coverage 95.40% 95.33% -0.08%
==========================================
Files 5 5
Lines 1721 1694 -27
Branches 154 135 -19
==========================================
- Hits 1642 1615 -27
Misses 52 52
Partials 27 27 ☔ View full report in Codecov by Sentry. |
I have a biased opinion for the proposed change. Also, please make a separate PR for fixing mentioned loop binding bugs. |
I used inheritance for the reason that it looks the most sensible here: existing Condition classes are extended with additional notification methods. The helper ones are prefixed with The event loop binding bug is that if a user tries to call asynchronous methods from two different threads, then due to non-exclusive access to conditions there may be a situation when some The fix is to prematurely bind the event loop in each asynchronous method, to safely prevent situations where asynchronous methods from two event loops are used. Of course, the README explicitly states not to support different event loops, but users can make mistakes, which is especially common in the asynchronous world. I did not put this fix in a separate PR for the reason that it is more a consequence of the notifier refactoring itself and can be seen as a side effect. The main purpose of this PR is to secure janus from any incorrect changes that could break notification thread-safety. This is why the counter handling is encapsulated directly in the OK, I will update the PR soon according to your requests. |
Since 1d91757, the fix is really a side effect: there is no way to set an event loop in the |
Unless we can reverse the order of changes and apply the PR with the fix first. It can be seen as removing unnecessary |
What do these changes do?
This PR encapsulates the notification logic into new Condition subclasses, making it easier to understand the code and add new changes.
Are there changes in behavior for the user?
There are no behavior changes for users.