Skip to content

Commit

Permalink
Keep queued messages after abort.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Nov 11, 2024
1 parent 86bf0c5 commit f17c11a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/websockets/asyncio/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def abort(self) -> None:
"""Close the queue, raising EOFError in get() if necessary."""
if self.get_waiter is not None and not self.get_waiter.done():
self.get_waiter.set_exception(EOFError("stream of frames ended"))
# Clear the queue to avoid storing unnecessary data in memory.
self.queue.clear()


class Assembler:
Expand Down
7 changes: 0 additions & 7 deletions tests/asyncio/test_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ async def test_abort(self):
with self.assertRaises(EOFError):
await getter_task

async def test_abort_clears_queue(self):
"""abort clears buffered data from the queue."""
self.queue.put(42)
self.assertEqual(len(self.queue), 1)
self.queue.abort()
self.assertEqual(len(self.queue), 0)


class AssemblerTests(unittest.IsolatedAsyncioTestCase):
async def asyncSetUp(self):
Expand Down

0 comments on commit f17c11a

Please sign in to comment.