Skip to content

Consume TTS requests from a deque, not list.pop(0) - #281

Merged
alexkroman merged 1 commit into
mainfrom
claude/tts-deque-popleft
Oct 22, 2026
Merged

alexkroman merged 1 commit into
mainfrom
claude/tts-deque-popleft

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Follow-up to #279, addressing Aikido's review comment. #279 entered the merge queue before this could be pushed.

The multi-request TTS loop in tts/session.py took chunks with pending.pop(0), which shifts every remaining chunk, so a long --url/PDF text did quadratic work queueing its requests. pending is now a collections.deque consumed with popleft(), which is O(1) per chunk. Behavior is unchanged: still at most 3 requests in flight, sent in order.

./scripts/check.sh: All checks passed. The existing multi-request tests in tests/test_tts_session_multi.py cover the ordering and in-flight bound.

🤖 Generated with Claude Code

pop(0) shifts every remaining chunk, so a long --url/PDF text did quadratic
work queueing its requests; deque.popleft() is O(1). (Aikido review.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexkroman
alexkroman added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit a4a7760 Oct 22, 2026
20 checks passed
@alexkroman
alexkroman deleted the claude/tts-deque-popleft branch October 22, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants