Skip to content

perf(stream): channel-based iteration, drop locks#320

Merged
0x676e67 merged 3 commits intomainfrom
stream
Sep 2, 2025
Merged

perf(stream): channel-based iteration, drop locks#320
0x676e67 merged 3 commits intomainfrom
stream

Conversation

@0x676e67
Copy link
Copy Markdown
Owner

@0x676e67 0x676e67 commented Sep 2, 2025

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the stream iterator implementation to use channel-based iteration instead of mutex-protected streams, improving performance by eliminating lock contention.

  • Replaces Arc<Mutex<Option<BytesStream>>> with mpsc::Receiver<wreq::Result<Bytes>>
  • Spawns a background task to feed stream data into the channel
  • Updates error handling to provide more specific messages for channel states

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/error.rs Updates StopAsyncIteration error to include TryRecvError for better channel error handling
src/client/response/stream.rs Refactors Streamer to use MPSC channels instead of mutex-protected streams

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@0x676e67 0x676e67 merged commit 5c59e9d into main Sep 2, 2025
17 checks passed
@0x676e67 0x676e67 deleted the stream branch September 2, 2025 06:15
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