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
Add a send_async method to the Signal #76
Conversation
042b329
to
f2610a4
Compare
Note that if async coroutines are connected to any signal's |
I saw that previous code to supprt async was reverted. Can we merge this one in and get a release soon? |
We'll merge this when we're ready and have time. Async as it works in a hybrid environment, and how it will work with Flask and quart, is a very complex question. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@Secrus what do you make of this? |
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 surely needs a proper documentation entry.
I've added documentation |
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.
Needs a rebase with main
, other than that, LGTM.
This allows for signals to send to coroutine receivers by awaiting them. The _async_wrapper and _sync_wrapper allows for conversion of sync and async receivers as required if defined. If not defined a runtime error is raised. The wrappers are used to avoid any direct tie into asyncio, trio, greenbacks, asgiref, or other specific async implementation.
Just as an observation on the principle of least surprise, I would have intuitively expected
|
This allows for signals to send to coroutine receivers by awaiting
them. The _async_wrapper and _sync_wrapper allows for conversion of
sync and async receivers as required if defined. If not defined a
runtime error is raised.
The wrappers are used to avoid any direct tie into asyncio, trio,
greenbacks, asgiref, or other specific async implementation.