simplify ReceiveStream.Read implementation#5500
Conversation
Simplify
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the ReceiveStream.Read implementation to improve code clarity and performance without changing functional behavior. The changes simplify stream cancellation checks and optimize deadline timer usage.
Key changes:
- Introduced a helper method
isRemoteCancellationEffective()to consolidate repeated cancellation logic - Optimized deadline timer creation to only arm the timer when actually waiting for data, rather than pre-emptively when data is already available
- Removed redundant conditional check before calling
dequeueNextFrame()after waiting
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* simplify check for stream cancellations * only arm deadline timer if there’s no data to read * remove redundant nil check
* simplify check for stream cancellations * only arm deadline timer if there’s no data to read * remove redundant nil check
No functional change expected.