python-trio / python-trio/trio
Add ability to adjust length of the buffer underlying a memory channel
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.3k
- Forks
- 431
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 6
Description
I was thinking it would be nice in the future for auto-tuning algorithms to adjust queue max-lengths in real-time without having to copy references around. If there are currently no barriers or complex mechanisms to achieve this (ie all the logic for queue size checks and waiters is local to one place and easily synchronized), then it could add versatility for the future.
As for scenarios that would make use of this, you could implement a reverse proxy that could handle both slow and fast connections efficiently (where connection speed isn't first known), or a single queue whose units of work can be predicted to be following an increasing or decreasing trend over time, and a secondary structure could be used to raise or lower the length based on achieving a specific total weighted sum of the queue's units.
Another ("BoundedDynamicQueue" for instance) class could be used that enables setting the length, but if it really is a couple of lines difference, it may serve better being merged into the default implementation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the memory-channel implementation and inspect the queue-size checks and waiter synchronization first. Compare an adjustable default implementation with a separate BoundedDynamicQueue, then define the resizing API and synchronization behavior. Done means the chosen design is implemented with coverage for changing the queue length safely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100