Use threadpool for reading from file in sendfile fallback mode (#14076)

This commit is contained in:
Andrew Svetlov 2019-06-15 14:05:35 +03:00 committed by GitHub
parent ef2152354f
commit 0237265e82
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()