Update documentation: max_queue exists in threading implementation
Summary
Fixes the documentation in "Memory and Buffers" topic page which incorrectly stated that max_queue doesn't exist in the threading implementation.
Issue
The documentation stated:
In the :mod:
threadingimplementation, there is no queue of incoming messages. Themax_queueargument doesn't exist. The connection keeps at most one message in memory at a time.
However, the threading (sync) implementation does have the max_queue argument and it works the same way as in the new asyncio implementation.
Changes
Updated docs/topics/memory.rst to correctly document that:
- The
max_queueargument exists in the threading implementation - It has the same semantics as the new asyncio implementation
- It is the high-water mark of a queue of incoming frames
- It defaults to 16 frames (same as asyncio)
- It provides backpressure control when the queue grows above the high-water mark
Context
As noted by @aaugustin in the issue, max_queue wasn't in the initial version of the threading implementation but was added later as a performance optimization. The documentation was never updated to reflect this change.
Closes #1544
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
django-sesame.readthedocs.io
- Triggering command:
/usr/bin/python3 /home/REDACTED/.local/bin/sphinx-build -M html . _build(dns block)docs.python.org
- Triggering command:
/usr/bin/python3 /home/REDACTED/.local/bin/sphinx-build -M html . _build(dns block)werkzeug.palletsprojects.com
- Triggering command:
/usr/bin/python3 /home/REDACTED/.local/bin/sphinx-build -M html . _build(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
Original prompt
This section details on the original issue you should resolve
<issue_title>"Memory and Buffers" docs and max_queue in threading implementation</issue_title> <issue_description>I believe the topic page "Memory and Buffers" in the documentation might need to be updated - in the end it says:
In the threading implementation, there is no queue of incoming messages. The max_queue argument doesn’t exist. The connection keeps at most one message in memory at a time.
But looks like max_queue exists in the threading implementation - I guess works the same as in the asyncio one?</issue_description>
Comments on the Issue (you are @copilot in this section)
@aaugustin Good catch, thank you. I think it wasn't there in the initial version, then got added later as a performance optimization. Yes it has the same semantics as in the asyncio implementation.
Fixes python-websockets/websockets#1664
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.