-
Notifications
You must be signed in to change notification settings - Fork 63
feat: handle CancelledError - cancel if no other waiters + refactoring #708
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
Conversation
CodSpeed Performance ReportMerging #708 will improve performances by ×560Comparing Summary
Benchmarks breakdown
|
|
Yeah this is better than #697 , check out the performance gains that come with it |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #708 +/- ##
==========================================
- Coverage 97.22% 97.05% -0.17%
==========================================
Files 12 13 +1
Lines 793 816 +23
Branches 41 42 +1
==========================================
+ Hits 771 792 +21
- Misses 20 22 +2
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| @property | ||
| def __tasks(self) -> List["asyncio.Task[_R]"]: | ||
| # NOTE: I don't think we need to form a set first here but not too sure we want it for guarantees | ||
| return list( |
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 think a list is probably overkill, we could just return an iterator for all the uses I saw.
| { | ||
| cache_item.task | ||
| for cache_item in self.__cache.values() | ||
| if not cache_item.task.done() |
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 don't think the condition is needed or useful for the use cases I saw.
|
I think we can merge the appropriate changes into the other PR, to keep reviewing in one place. |
| self.__closed = True | ||
|
|
||
| tasks = list(self.__tasks) | ||
| tasks = self.__tasks |
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.
we need to materialize tasks into a list or set or some other container here
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.
Well, that's already handled by the original code.
This is a second option for #697 with the comments in that PR implemented here for separate review