RxJava icon indicating copy to clipboard operation
RxJava copied to clipboard

3.x: Add onDropped callbacks to operators

Open akarnokd opened this issue 2 years ago • 2 comments

Add onDropped callback overloads to most operators that drop items that can't be recovered by other means.

  • [x] throttleLatest PR #7457
  • [ ] throttleFirst (PR TBD)
  • [ ] throttleLast / sample (PR TBD)
  • [ ] throttleWithTimeout / debounce (PR TBD)
  • [ ] onBackpressureLatest (PR TBD)
  • [ ] onBackpressureBuffer (PR TBD)
    • 📓 The current overloads with Action are somewhat unhelpful, however, we'll have to add overloads in a way that avoids lambda ambiguity.

akarnokd avatar Aug 08 '22 12:08 akarnokd

Hi - do you need any help with some of these?

Desislav-Petrov avatar Sep 15 '22 21:09 Desislav-Petrov

@Desislav-Petrov you can have a stab at them. I won't have the time for weeks although there is no rush either.

akarnokd avatar Sep 16 '22 06:09 akarnokd

Thanks, starting this week and will follow your PR per method strategy - I've started with throttleFirst

Desislav-Petrov avatar Oct 18 '22 21:10 Desislav-Petrov

hi @akarnokd - i'm looking at throttleLast. From what I see, we should change the public void onNext(T t) method in the *SampleTimed class. More precisely, when we do the lazySet() we should check if a value exists there - if so we need to call the onDropped with this value as this is what we're dropping. Does this make sense?

Desislav-Petrov avatar Nov 21 '22 22:11 Desislav-Petrov

@Desislav-Petrov lazySets have to be made getAndSet: https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatest.java#L130

akarnokd avatar Nov 22 '22 08:11 akarnokd

Thx - leave this with me, will do a PR shortly.

Desislav-Petrov avatar Nov 26 '22 17:11 Desislav-Petrov

taking a look at throttleWithTimeout / debounce next

Desislav-Petrov avatar Dec 25 '22 22:12 Desislav-Petrov

Looking at onBackpressureLatest next

Desislav-Petrov avatar Feb 05 '23 13:02 Desislav-Petrov