Closed VAndrJ closed 1 month ago
I like this change. It's something that has always bugged me. It should probably wait for the major version bump.
Seems like a good fix!
I'm wondering if we can somehow pull it into the current release by doing something like thorttle(..., rounding: FloatingPointRoundingRule = . toNearestOrAwayFromZero)
and being able to override it to up
.
(Or think of a different "behavior" argument). This will allow to be backward compatible during RxSwift 6.x and then make this the default behavior in RxSwift 7.x.
Thoughts?
I know this has been an issue since at least 5.0.0 (see for eg: https://github.com/ReactiveX/RxSwift/issues/2098) And I've always used milliseconds
in production code because of it. So I know none of my apps would be affected by the fix.
I like the idea of adding the parameter so we can put this fix in sooner...
When using
.seconds(1)
, 2 elements are emitted per second. MRE with problem reproduction:MRE
```swift import SwiftUI import RxSwift import RxCocoa struct ContentView: View { private let valuesObs = PublishRelayResult of MRE:
As we can see, due to rounding, 2 elements are emitted per second, but only one should.