Skip to content

Throttle operator doesn't work correctly with sync duration selector #5443

Description

@fr-ench

Bug Report

Current Behavior
If a sync duration selector is used in throttle operator, throttle operator won't recognise it has emitted an event and will keep on throttling all other events.

According to throttle documentation duration selector is "A function that receives a value from the source Observable, for computing the silencing duration for each source value, returned as an Observable or a Promise.", hence I would expect it to work with sync streams. Besides, the same behaviour does work as expected with the debounce operator.

Reproduction

https://stackblitz.com/edit/rxjs-w7dbvs

Please see console, to see all both async duration selectors and debounce operator keep on emitting events, while throttle operator with sync duration selector keeps on ignoring them as if no event was emitted by duration selector.

Expected behavior
The throttle operator should work with a sync Observable the same way it does work with async one (and the same way debounce operator does). If sync duration selector is used, throttle should keep on immediately emitting the following events and not ignoring them.

Environment

  • Runtime: Chrome
  • RxJS version: both ^6.5.2 and 7.0.0-beta.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions