#37177: Performance issue in Async Middleware handling.
--------------------------------+---------------------------------------
Reporter: Carlton Gibson | Owner: Jacob Walls
Type: Bug | Status: assigned
Component: HTTP handling | Version: 6.0
Severity: Normal | Resolution:
Keywords: async | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by Jacob Walls):
* owner: (none) => Jacob Walls
* stage: Unreviewed => Accepted
* status: new => assigned
Comment:
This was mentioned on the [https://forum.djangoproject.com/t/sync-to-
async-called-14-times-with-default-django-middleware-and-2-times-with-no-
middleware/31701 forum] at least once, so thanks for the confirmation that
this runs counter to the original design.
> I'm not sure we can just flip the flag — that's what I did for the
benchmark — but maybe MiddlewareMixin could check to see if
process_request/process_response were coroutine function or not before
just declaring True? (There's probably a little more due diligence to do
there too.)
Just flipping the flag is what a user did, when they saw this in their own
middleware, as for them it was a regression, see
[https://forum.djangoproject.com/t/issues-with-middleware-in-django-3-1
-using-asgi/4080/3 forum], but given how many releases have followed,
introspecting seems like the most backward-compatible thing we can do
right now.
Separately, I have a question about how much longer we plan to maintain
`MiddlewareMixin`.
Tentatively assigning to myself, to see if we can advance this before next
Wednesday's bug freeze for 6.1.
--
Ticket URL: <https://code.djangoproject.com/ticket/37177#comment:6>
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/0107019edafe07e4-518463fa-94f6-45c6-96c5-5d96ca9b83ec-000000%40eu-central-1.amazonses.com.