Bugfix/fix scheduling operators - #32
Merged
Merged
Conversation
…, LimitTrueDuration and their False variants) are now implemented as explicit state machines that subscribe to the source exactly once and drive a single timer on the provided IScheduler. Fixed - TrueForAtLeast/PersistTrueFor/LimitTrueDuration no longer depend on the source fanning out each value to all subscribers before producing the next one. Sources such as SelectMany bursts, Observable.Return(...).Concat(...) or arrays converted with ToObservable() produced wrong output (e.g. TrueForAtLeast emitting only "false", or releasing a "false" immediately instead of after the timespan). - Deferred and other cold sources were subscribed three to four times per subscriber; they are now subscribed once. - When the source completed while a timer was running, the pending value leaked immediately (WhenTrueFor could report "true" before the timespan had passed). Pending values are now dropped on completion by default; see CompletionBehavior below. - LimitTrueDuration (distinct): a repeated "true" after the limit re-emitted "true" and never limited it again. It is now ignored until the source emits "false", unless resetTimerOnConsecutiveTrue is set, in which case it re-arms the limit. Added - CompletionBehavior parameter on all scheduling methods: CompleteImmediately (default) drops a value still pending on the timer; CompleteAfterTimer waits for the timer, emits it, then completes. - distinctUntilChanged parameter on WhenTrueFor, WhenFalseFor, PersistTrueFor and PersistFalseFor. It follows the existing resetTimerOnConsecutive* parameter so positional callers keep working. - Tests covering five source shapes (Subject, SelectMany burst, cold array, cold Concat, Defer+Prepend), single subscription, disposal, and both completion behaviors for every scheduling operator. Compatibility - Source-compatible; recompile against this version (new optional parameters change method signatures). - Behavior change: values previously leaked on source completion are no longer emitted unless CompletionBehavior.CompleteAfterTimer is passed. - TrueForAtLeast now returns the source unchanged for a zero or negative timespan, like PersistTrueFor and WhenTrueFor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.