Skip to content

debounce behavior #282

Description

@michaelsbradleyjr

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)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions