-
Notifications
You must be signed in to change notification settings - Fork 232
added AsyncSingleThreadContext #511
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
added AsyncSingleThreadContext #511
Conversation
ebccae6 to
495ec35
Compare
|
Hi! how can we help getting this reviewed? |
|
Hey @fcurella. You can review it. Tell me it works 🙂 |
|
@Arfey the code LGTM, but I think she should add some documentation in |
|
I'd forgotten about this 🤹♀️ I've been meaning to get to your PR @fcurella. Again 🤹♀️. When I looked at this initially I thought "seems sensible". Looking again (Friday afternoon) the description is a bit quick/loose. A comment along the lines of "yes, this looks correct to me because ..." would help me pick it up again. Happy to get a release out with it if we're confident. |
tests/test_sync.py
Outdated
|
|
||
| await sync_to_async(inner)() | ||
|
|
||
| # They should not have run in the main thread, and on the same threads |
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.
| # They should not have run in the main thread, and on the same threads | |
| # They should have run in the main thread, and on the same threads |
|
I've verified that:
|
|
Ok, great thanks. Let me look at it properly next week. |
495ec35 to
bd23f84
Compare
|
https://pypi.org/project/asgiref/3.10.0/ Thanks both! |
I have a problem with async database connections for
DjangoTestCase.The psycopg3 connection is not thread-safe. As a result, I need to create a new connection per thread. This is a problem for the
TestCasecoz it uses a transaction for each test case.I can do something like that coz each async_to_sync function uses a new thread executor (and different connection as a result). To solve that, I try to implement something similar for ThreadSensitiveContext.