diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2019-06-15 11:05:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-15 11:05:35 (GMT) |
commit | 0237265e8287141c40faa8719da3a2d21d511d0d (patch) | |
tree | 5df00acc5a5d5e061d83abd85f1134e8d73e0aba | |
parent | ef2152354f03a165c5e3adb53e2276934fabd50a (diff) | |
download | cpython-0237265e8287141c40faa8719da3a2d21d511d0d.zip cpython-0237265e8287141c40faa8719da3a2d21d511d0d.tar.gz cpython-0237265e8287141c40faa8719da3a2d21d511d0d.tar.bz2 |
Use threadpool for reading from file in sendfile fallback mode (#14076)
-rw-r--r-- | Lib/asyncio/base_events.py | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-06-14-13-30-47.bpo-37280.Fxur0F.rst | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 90de858..14b80bd 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -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() diff --git a/Misc/NEWS.d/next/Library/2019-06-14-13-30-47.bpo-37280.Fxur0F.rst b/Misc/NEWS.d/next/Library/2019-06-14-13-30-47.bpo-37280.Fxur0F.rst new file mode 100644 index 0000000..7cdc56a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-06-14-13-30-47.bpo-37280.Fxur0F.rst @@ -0,0 +1 @@ +Use threadpool for reading from file for sendfile fallback mode. |