How to implement buffering with timeout in RX

Posted by Gaspar Nagy on Stack Overflow See other posts from Stack Overflow or by Gaspar Nagy
Published on 2011-01-11T08:05:44Z Indexed on 2011/01/12 15:53 UTC
Read the original article Hit count: 263

Filed under:
|
|

I need to implement an event processing, that is done delayed when there are no new events arriving for a certain period. (I have to queue up a parsing task when the text buffer changed, but I don't want to start the parsing when the user is still typing.)

I'm new in RX, but as far as I see, I would need a combination of BufferWithTime and the Timeout methods. I imagine this to be working like this: it buffers the events until they are received regularly within a specified time period between the subsequent events. If there is a gap in the event flow (longer than the timespan) it should return propagate the events buffered so far.

Having a look at how Buffer and Timeout is implemented, I could probably implement my BufferWithTimeout method (if everyone have one, please share with me), but I wonder if this can be achieved just by combining the existing methods. Any ideas?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about rx