-
Notifications
You must be signed in to change notification settings - Fork 176
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
Speed up P2P client creation #343
Conversation
Codecov Report
@@ Coverage Diff @@
## master #343 +/- ##
==========================================
+ Coverage 83.33% 83.40% +0.07%
==========================================
Files 66 66
Lines 5977 5973 -4
==========================================
+ Hits 4981 4982 +1
+ Misses 996 991 -5
|
Fantastic results! 🚀 One more thing to check is how the daemon behave in case of incorrect arguments. Ideally, we'd like to capture the daemon's stderr, read the error message, and convert it to a Python error with this message. |
Co-authored-by: Alexander Borzunov <[email protected]>
self._listen_task = None | ||
self._server_stopped = asyncio.Event() |
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.
This event is redundant, we can just cancel self._listen_task
.
|
||
self._listen_task = asyncio.create_task(listen()) | ||
|
||
async def _stop_listening(self) -> None: |
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.
Cancelling self._listen_task
is enough here. The corresponding code moved to self._terminate()
(since it is not async anymore).
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 approve @deniskamazur's changes, and Denis approves mine as well :)
This PR resolves #300 and speeds up the creation of P2P clients by reading the daemon's stdout instead of pinging it repeatedly.
This optimization speeds up running the tests by 35% locally. Here are the benchmarks:

