#36863: Under WSGI, multiple calls to asgiref.sync.async_to_sync within the same
request do not share the same event loop.
----------------------------------+--------------------------------------
Reporter: Mykhailo Havelia | Owner: Vishy Algo
Type: Bug | Status: assigned
Component: HTTP handling | Version: 6.0
Severity: Normal | Resolution:
Keywords: async, wsgi | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Comment (by Mykhailo Havelia):
Replying to [comment:4 Vishy Algo]:
I prepared an MR, but it seems it's not sufficient:
https://github.com/django/django/pull/20552. I added a test that compares
not just the thread, but the event loop as well, and the event loop isn't
the same. asgiref uses the same thread, but it starts a new event loop for
each function via asyncio.run
(https://github.com/django/asgiref/blob/main/asgiref/sync.py#L314).
I could try creating a loop myself and run each function via
loop.run_until_complete, but that would require some additional
investigation to see if it's feasible.
What do you think?
--
Ticket URL: <https://code.djangoproject.com/ticket/36863#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019bcecfb62d-426d81f4-aba4-4f39-b7d6-23122ec43af9-000000%40eu-central-1.amazonses.com.