[3.8] Use threadpool for reading from file in sendfile fallback mode (GH-14076) (GH-14102)

(cherry picked from commit 0237265e82)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
This commit is contained in:
Andrew Svetlov 2019-06-15 14:55:52 +03:00 committed by GitHub
parent 6887814069
commit b6ff2cd8c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -1141,7 +1141,7 @@ class BaseEventLoop(events.AbstractEventLoop):
if blocksize <= 0:
return total_sent
view = memoryview(buf)[:blocksize]
read = file.readinto(view)
read = await self.run_in_executor(None, file.readinto, view)
if not read:
return total_sent # EOF
await proto.drain()