#33495: "Synchronous middleware ... adapted" is not logged for synchronous
middleware
-------------------------------------+-------------------------------------
Reporter: Aaron Chong | Owner: Aaron
Type: | Chong
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: 4.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 Carlton Gibson):
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
OK, pending Andrew's comment, I'm going to accept this as a potential
cleanup.
It's the wrapped handler that's adapted to the wrapping middleware. So, I
agree that the existing message perhaps implies the wrong thing:
{{{
Synchronous middleware
middleware_exceptions.middleware.async_payment_middleware adapted.
}}}
(in `./runtests.py
middleware_exceptions.tests.MiddlewareSyncAsyncTests.test_async_middleware`)
Here it's the (sync) `BaseHandler._get_response()` that's actually
adapted, via `return sync_to_async(method, thread_sensitive=True)`
(ln119).
Tweaking the message to something like, `Synchronous handler adapted for
middleware_exceptions.middleware.async_payment_middleware middleware.`
would be perhaps clearer 🤔
(I'd like to keep the messaging consistent on each branch — i.e. not
mixing `Synchronous` and `Asynchronous` in the messages — as that lets you
search for the log message without doubt as to which branch you're on,
even if we can improve the exact wording.)
--
Ticket URL: <https://code.djangoproject.com/ticket/33495#comment:1>
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 on the web visit
https://groups.google.com/d/msgid/django-updates/062.aefc39c6be2d0c05299df8e7a3116083%40djangoproject.com.