-
Notifications
You must be signed in to change notification settings - Fork 111
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
Exploring Sans-io #349
Comments
you could go a step further and put the calls to we then get a |
i like all of these pros :) i agree that this is the more heavy-handed approach in that it is a more serious rewrite of the library, rather than just |
This requires large parts of the library to be synchronous, which could take away advantages in With this implimentation, logic code could run blocking indefinitely till it gives control back to its async-envoked entry point, after which only then async code is allowed to run (such as vital parts like ping, heartbeats, or connection management) Unless these synchronous functions are ran in an alternative thread, and all calls and accesses to the other thread with the event loop are thread-safe and without race conditions, I personally don't think this is a good idea. |
This is a different approach to fix #174
We first refactor classes using the Sans-io pattern. Separate out all async functions and then support both trio and even asyncio if we want to.
Here's an example how we can refactor the class GossipSub
before: The async function publish writes some data to peers
after: maximally abstracting out the async part
The text was updated successfully, but these errors were encountered: