Feature Request: Buffer with TimeSpan overload
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 798
- PR merge metrics
- No merged PRs in 30d
Description
#### Feature request
For IAsyncEnumerable there is a buffer overload based on size already: https://github.com/dotnet/reactive/blob/main/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Buffer.cs#L22
For IObservable there is a buffer overload based on size and TimeSpan:
https://github.com/dotnet/reactive/blob/main/Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Time.cs#L52
For AsyncRx.Net there is also an implementation here:
https://github.com/dotnet/reactive/blob/main/AsyncRx.NET/System.Reactive.Async.Linq/System/Reactive/Linq/Operators/Buffer.cs#L153
There is also a stackoverflow post around this topic: https://stackoverflow.com/questions/67661709/how-to-batch-an-iasyncenumerablet-enforcing-a-maximum-interval-policy-between
The stackoverflow post contains a implementation but I can't say anything about the quality of it.
When using channels there is also an implementation for that in this library: https://github.com/Open-NET-Libraries/Open.ChannelExtensions/blob/847ba9aebd125091e7b42119bad0b9a3ba136ee5/Open.ChannelExtensions/Extensions.Batch.cs#L20
I'm not sure why there is no buffer overload for IAsyncEnumerable but I think it would be great to have one.
In my use-case I don't want to use IObservable because I don't want to have unbounded queues when using hot subjects. So I tried to go the Channel(Reader) way to have a pull based model with backpressure support to slow down the producer. For ChannelReader there are some "linq" like operators in the "Open.ChannelExtensions" library mentioned above which is great but other operators found in this repository are part of IAsyncEnumerable so I wondered if it wouldn't be cleaner to have such an implementation directly in Async.Ix. Converting a ChannelReader into a IAsyncEnumerable is very easy and would make the operator available to a broader ecosystem (IAsyncEnumerable > ChannelReader).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.