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

Use loop.sendfile() for file sending on Python 3.7+ #4269 #4328

Closed
wants to merge 3 commits into from
Closed

Use loop.sendfile() for file sending on Python 3.7+ #4269 #4328

wants to merge 3 commits into from

Conversation

alex-kostirin
Copy link

What do these changes do?

Implemented loop.sendfile() for file sending on Python 3.7+

Are there changes in behavior for the user?

None

Related issue number

#4269

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> for example (588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 8, 2019
@codecov-io
Copy link

codecov-io commented Nov 8, 2019

Codecov Report

Merging #4328 into master will decrease coverage by 0.28%.
The diff coverage is 58.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4328      +/-   ##
==========================================
- Coverage   97.55%   97.26%   -0.29%     
==========================================
  Files          43       43              
  Lines        8862     8873      +11     
  Branches     1389     1389              
==========================================
- Hits         8645     8630      -15     
- Misses         93      120      +27     
+ Partials      124      123       -1
Impacted Files Coverage Δ
aiohttp/web_fileresponse.py 85.56% <58.82%> (-12.17%) ⬇️
aiohttp/worker.py 94.11% <0%> (-2.53%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0bd628...4476888. Read the comment docs.

@alex-kostirin
Copy link
Author

It should be also noted that I kept implementation of _sendfile_fallback from aiohttp. Asyncio's _sendfile_fallback implementation uses file reading directly without ThreadPoolExecutor. Othervise aiohttp's implementation is with ThreadPoolExecutor

@asvetlov
Copy link
Member

asvetlov commented Nov 9, 2019

asyncio does use run_in_executor for file reading:
https://github.com/python/cpython/blob/master/Lib/asyncio/base_events.py#L890

@asvetlov
Copy link
Member

Fixed by #4517

@asvetlov asvetlov closed this Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants