Skip to content

Commit

Permalink
Avoid calling the drain helper in WebSocketWriter if the protocol i…
Browse files Browse the repository at this point in the history
…s not paused (#9796)
  • Loading branch information
bdraco authored Nov 11, 2024
1 parent d1eecea commit b947e47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/9796.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved performance of the ``WebsocketWriter`` when the protocol is not paused -- by :user:`bdraco`.
3 changes: 2 additions & 1 deletion aiohttp/_websocket/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ async def send_frame(
# if the writer is not paused.
if self._output_size > self._limit:
self._output_size = 0
await self.protocol._drain_helper()
if self.protocol._paused:
await self.protocol._drain_helper()

def _make_compress_obj(self, compress: int) -> ZLibCompressor:
return ZLibCompressor(
Expand Down

0 comments on commit b947e47

Please sign in to comment.