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

Replace get_event_loop with get_running_loop in the compressor #9780

Merged
merged 3 commits into from
Nov 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions aiohttp/compression_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
self._max_sync_chunk_size is not None
and len(data) > self._max_sync_chunk_size
):
return await asyncio.get_event_loop().run_in_executor(
self._executor, self.compress_sync, data
return await asyncio.get_running_loop().run_in_executor(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we replace these low-level calls with asyncio.to_thread() now that we don't support 3.8?

self._executor, self._compressor.compress, data
)
return self.compress_sync(data)

Expand Down Expand Up @@ -111,8 +111,8 @@
self._max_sync_chunk_size is not None
and len(data) > self._max_sync_chunk_size
):
return await asyncio.get_event_loop().run_in_executor(
self._executor, self.decompress_sync, data, max_length
return await asyncio.get_running_loop().run_in_executor(

Check warning on line 114 in aiohttp/compression_utils.py

View check run for this annotation

Codecov / codecov/patch

aiohttp/compression_utils.py#L114

Added line #L114 was not covered by tests
bdraco marked this conversation as resolved.
Show resolved Hide resolved
self._executor, self._decompressor.decompress, data, max_length
)
return self.decompress_sync(data, max_length)

Expand Down
Loading