-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Correct request.app context (for handlers not just middlewares) #2577
Conversation
@asvetlov , I'm not sure about target branch — should it be master or some bugfix branch? |
I'll cherry-pick to 2.3 myself |
Codecov Report
@@ Coverage Diff @@
## master #2577 +/- ##
==========================================
- Coverage 97.71% 97.71% -0.01%
==========================================
Files 36 36
Lines 7229 7228 -1
Branches 1262 1261 -1
==========================================
- Hits 7064 7063 -1
Misses 58 58
Partials 107 107
Continue to review full report at Codecov.
|
thanks! |
* yield _fix_request_current_app middleware uncoditionally; update test; (see #2550) * Add change notes
Just FYI this fix impacted with a loss btw 5%-10% of the performance, we should try to make it in some way that does not reuse the middlewares code to setup also the current app when there are no middlewares installed. |
Does it make sens to optimize for the case where there is no middleware? |
The check should analyze not only middlewares but nested applications also. |
The performance loss might be introduced by making |
Fixes performance issue introduced by #2577, boosting from 8K req/sec to almost 9K req/sec. If there are no middlewares installed by the user the attribute `request._match_info.current_app` already looks at to the right app, this is by design.
) * Skip middleware code when there are no user middlewares installed Fixes performance issue introduced by #2577, boosting from 8K req/sec to almost 9K req/sec. If there are no middlewares installed by the user the attribute `request._match_info.current_app` already looks at to the right app, this is by design.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
This is an update to #2550
_fix_request_current_app
middleware was added if application had any middlewares.Now it is yielded unconditionally to set proper context for handlers as well.