Skip to content
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

Revise middleware handling #2521

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Revise middleware handling #2521

wants to merge 12 commits into from

Conversation

ahopkins
Copy link
Member

@ahopkins ahopkins commented Aug 7, 2022

This PR aims to:

  • introduce an API to control middleware ordering
  • performance boost
@app.on_request(priority=99)
async def high_priority(request):
    ...

@codecov
Copy link

codecov bot commented Aug 7, 2022

Codecov Report

Base: 87.844% // Head: 70.943% // Decreases project coverage by -16.900% ⚠️

Coverage data is based on head (09b59d3) compared to base (389363a).
Patch coverage: 87.500% of modified lines in pull request are covered.

❗ Current head 09b59d3 differs from pull request most recent head 38b4ccf. Consider uploading reports for the commit 38b4ccf to get more accurate results

Additional details and impacted files
@@              Coverage Diff               @@
##              main     #2521        +/-   ##
==============================================
- Coverage   87.844%   70.943%   -16.901%     
==============================================
  Files           78        70         -8     
  Lines         6466      5627       -839     
  Branches      1247       972       -275     
==============================================
- Hits          5680      3992      -1688     
- Misses         560      1465       +905     
+ Partials       226       170        -56     
Impacted Files Coverage Δ
sanic/request.py 48.989% <50.000%> (-45.896%) ⬇️
sanic/middleware.py 92.592% <92.592%> (ø)
sanic/mixins/middleware.py 97.435% <94.736%> (-2.565%) ⬇️
sanic/app.py 83.742% <100.000%> (-3.758%) ⬇️
sanic/signals.py 90.298% <100.000%> (-2.403%) ⬇️
sanic/cookies.py 41.558% <0.000%> (-58.442%) ⬇️
sanic/handlers.py 39.423% <0.000%> (-57.899%) ⬇️
sanic/http/http1.py 35.915% <0.000%> (-49.296%) ⬇️
sanic/response.py 42.487% <0.000%> (-47.136%) ⬇️
... and 44 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ahopkins ahopkins marked this pull request as ready for review August 17, 2022 12:23
@ahopkins ahopkins requested a review from a team as a code owner August 17, 2022 12:23
@ahopkins ahopkins marked this pull request as draft August 20, 2022 19:23
@ahopkins ahopkins self-assigned this Aug 29, 2022
sanic/app.py Outdated Show resolved Hide resolved
@ahopkins
Copy link
Member Author

A lot more use cases to consider with some potential breaking changes. Will be safer to kick this one out until after LTS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

1 participant