python-trio / python-trio/trio

Should MemoryChannels have their buffers be growable and shrinkable?

Open
#2,080 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

design discussion
Dominant language
Python
Stars
7.3k
Forks
431
Avg merge
2d 17h
Merged PRs (30d)
6

Description

In my code, I use a channel to maintain a connection pool. The idea of being able to resize the pool by resizing the channel's buffer came to me. Would it be a good idea to have this available? It's certainly a niche design but potentially useful.

Growing would simply resize the underlying buffer, and wake up any senders. Shrinking would likely act the same way as CapacityLimiter, where the channel blocks any new senders until the buffer shrinks below the new buffer size.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the MemoryChannels implementation and the CapacityLimiter behavior referenced in the issue. Determine whether growable and shrinkable buffers fit the channel design, including how shrinking should block senders, and document a concrete API and completion criteria before attempting implementation.

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
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.