Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debounce behavior #282

Open
michaelsbradleyjr opened this issue Sep 2, 2019 · 0 comments
Open

debounce behavior #282

michaelsbradleyjr opened this issue Sep 2, 2019 · 0 comments

Comments

@michaelsbradleyjr
Copy link
Contributor

michaelsbradleyjr commented Sep 2, 2019

IxJS version: 2.5.3 (RxJS version: 6.5.2, Node.js version: 10.16.3)

Code to reproduce: debouncePipe.js

Expected behavior:

When the script is run as-is:

$ node debouncePipe.js 
from: 3
batched: [ 3 ]
from: 5
from: 8
from: 9
batched: [ 5, 8, 9 ]
from: 12
batched: [ 12 ]

And that's what I expected when debouncing the Rx pipe.

Now, if line 32 is commented and 34 is uncommented, so that the pull pipe is debounced instead of the push pipe, I expect the results would be very similar.

Actual behavior:

With line 32 commented and 34 uncommented:

$ node debouncePipe.js
from: 1
batched: [ 1 ]
from: 3
from: 4
from: 5
from: 6
from: 8
from: 9
batched: [ 3, 4, 5, 6, 8, 9 ]
from: 10
from: 12
batched: [ 10, 12 ]

After running it several times, I find the output is consistent. Notice how from: 5 is reported but it seems like there wouldn't have been enough time for the 50ms debounce to expire; the same goes for some of the other from:.

Do I need to think about this differently or is there a bug and/or performance problem in Ix's debounce?

Additional information:

The input signature of Rx's debounce is different from Ix's debounce. I'm aware there's a rewrite (#264) underway but on that branch debounce still takes a number directly.

Would it make sense for Ix's operator to be revised so that a user would supply e.g. () => interval(50)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant