question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sample operator: last item before termination is dropped after sampling

See original GitHub issue

Hi. Recently I found that sample operator drops last value before onCompleted event. This is behaviour is valid according to these discussions https://github.com/ReactiveX/RxJava/pull/566 and https://github.com/ReactiveX/RxJava/pull/571 and this test. It originated in Rx.NET and still exists in RxJava to be consistent across all implementations as far as I understood.

But, marble diagram in documentation shows otherwise: item 5 is emitted before termination and sampled by sampler. sample_marble

This behaviour is odd and unexpectable. I stumbled across it trying to resolve backpressure issue with observables where last emitted item is the most important.

So, my question is whether it can be changed? I prepared a commit with fixes and corresponding tests. Or at least marble diagram should be changed to showcase this behaviour and it would be good to have a note about it in documentation.

Thank you.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kboyarshinovcommented, Mar 14, 2016
0reactions
akarnokdcommented, Mar 23, 2016

#3757 merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Random Samples and Permutations - Rdrr.io
Random Samples and Permutations. Description. sample takes a sample of the specified size from the elements of x using either with or without...
Read more >
Nyquist Functions
Note: With sounds, conversion is only performed on actual samples, not on the implicit zeros before the beginning and after the termination of...
Read more >
SAMPLE – Written Warning for Attendance
The purpose of this letter is to emphasize the seriousness of your attendance record (absenteeism) as a. [classification] with the [agency/department name] ...
Read more >
Sample operator - ReactiveX
The Sample operator periodically looks at an Observable and emits whichever item it has most recently emitted since the previous sampling.
Read more >
Flux (reactor-core 3.5.0)
Let compatible operators upstream recover from errors by dropping the incriminating element from the sequence and continuing with subsequent elements. <E ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found