Fix documented default for WebSocketResponse writer_limit - #13294
Dreamsorcerer merged 4 commits into
Conversation
The reference documented `writer_limit` as `65536` in the class signature and as "64 KB by default" in the parameter description, but the actual default is `DEFAULT_CHUNK_SIZE`, which is `2**18` (262144 bytes, 256 KiB). Readers sizing a WebSocket write buffer from the docs were working from a value four times smaller than the real one.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #13294 +/- ##
=======================================
Coverage 99.02% 99.02%
=======================================
Files 135 135
Lines 49992 49992
Branches 2597 2597
=======================================
Hits 49507 49507
Misses 366 366
Partials 119 119
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Merging this PR will degrade performance by 2.44%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_read_base64_part |
16 ms | 14.1 ms | +13.06% |
| 👁 | test_list_element_pattern_redos_payload[interleaved_quote_paren_triggers] |
87.5 ms | 96.4 ms | -9.25% |
| 👁 | test_list_element_pattern_redos_payload[whitespace_run_after_content] |
30.9 ms | 34.2 ms | -9.49% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing LALITH0110:docs/websocketresponse-writer-limit-default (c8a3bb6) with master (5836019)
Footnotes
-
83 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "Update web_reference.rst" | Re-trigger Greptile |
Backport to 3.15: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply f1c70aa on top of patchback/backports/3.15/f1c70aa4b9160798603f56fd84937d78741ada53/pr-13294 Backporting merged PR #13294 into master
🤖 @patchback |
Backport to 3.14: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply f1c70aa on top of patchback/backports/3.14/f1c70aa4b9160798603f56fd84937d78741ada53/pr-13294 Backporting merged PR #13294 into master
🤖 @patchback |
|
Please follow instructions above for backports. |
What do these changes do?
Correct the documented default for
WebSocketResponse'swriter_limitparameter indocs/web_reference.rst.The reference documented it in two places:
writer_limit=65536The actual default in
aiohttp/web_ws.pyiswriter_limit: int = DEFAULT_CHUNK_SIZE, andDEFAULT_CHUNK_SIZEis2**18inaiohttp/helpers.py— that is 262144 bytes, or 256 KiB. So the documented value understated the real default by a factor of four.The signature now reads
writer_limit=262144, matching how the neighbouringmax_msg_size=4194304is written, and the prose now says "256 KiB by default".Documentation only — no code changes.
Are there changes in behavior for the user?
No. Nothing in the library changes. Users reading the docs to size a WebSocket write buffer will now see the value the code actually uses.
Is it a substantial burden for the maintainers to support this?
No. It is a two-line documentation correction with no ongoing maintenance cost.
Related issue number
None — found while comparing documented parameter defaults against the actual signatures.
Checklist
CONTRIBUTORS.txtCHANGES/folderDrafted with Claude Opus 5; reviewed by @LALITH0110.