Optimized MiddlewareMixin coroutine check.#15216
Conversation
|
Hey Adam, When I was looking at it, I was thinking about re-using the |
carltongibson
left a comment
There was a problem hiding this comment.
Afaiu get_response is never expected to change.
This is where we find folks dynamically munging middleware functions. 😜 (I agree that's not expected, so the change should be OK.)
For reference:
(I don't really have strong feelings here… — happy to go with what you agree.)
9987a06 to
842665a
Compare
Great minds think alike!
Absolutely right, I missed that, and have updated to use it. We can see
This would already be broken, as |
842665a to
fc82b30
Compare
Cache
get_response’s coroutine status. Afaiuget_responseis never expected to change.Repeating the check on every is unnecessary work - about 1 microsecond each time, on my machine's Python 3.10: