Commit 150c616
Fix CPU spin in BatchingChannelReader when source completes (#53)
* Initial plan
* Add repro test for batching hang issue
Co-authored-by: electricessence <5899455+electricessence@users.noreply.github.com>
* Fix CPU hang in BatchingChannelReader.WaitToReadAsyncCore
The issue was that after Task.WhenAny completed, the code did not await
the source task before looping. This caused a tight CPU-consuming loop
when the source channel was closed but the buffer was empty, as the
closed source would immediately return a completed ValueTask on each
WaitToReadAsync call.
The fix properly awaits the source task after WhenAny to check its
completion status, preventing the tight loop. This matches the pattern
used in the base BufferingChannelReader class.
Co-authored-by: electricessence <5899455+electricessence@users.noreply.github.com>
* Address code review feedback
- Remove unused System.Text.Json import from test
- Use consistent attribute style in test
- Add clarifying comment explaining the buffer completion check
Co-authored-by: electricessence <5899455+electricessence@users.noreply.github.com>
* Bump version to 9.1.2
Updated Open.ChannelExtensions.csproj to increase the project version from 9.1.1 to 9.1.2. No other modifications were made.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: electricessence <5899455+electricessence@users.noreply.github.com>1 parent 9d1aec2 commit 150c616
3 files changed
Lines changed: 69 additions & 2 deletions
File tree
- Open.ChannelExtensions.Tests
- Open.ChannelExtensions
- Readers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
| 249 | + | |
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
255 | 264 | | |
256 | 265 | | |
257 | 266 | | |
| |||
0 commit comments