8000 Use threadpool for reading from file in sendfile fallback mode (#14076) · python/cpython@0237265 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0237265

Browse files
authored
Use threadpool for reading from file in sendfile fallback mode (#14076)
1 parent ef21523 commit 0237265

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Lib/asyncio/base_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ async def _sendfile_fallback(self, transp, file, offset, count):
11411141
if blocksize <= 0:
11421142
return total_sent
11431143
view = memoryview(buf)[:blocksize]
1144-
read = file.readinto(view)
1144+
read = await self.run_in_executor(None, file.readinto, view)
11451145
if not read:
11461146
return total_sent # EOF
11471147
await proto.drain()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use threadpool for reading from file for sendfile fallback mode.

0 commit comments

Comments
 (0)
0