Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

[rx-lite] Passing a non-natural number to repeat causes infinite loop #1549

Description

@edorivai

Originally posted here: ReactiveX/rxjs#3415, but was told it belongs in this repo.

RxJS version:
rx-lite@4.0.8

Code to reproduce:

const Rx = require('rx-lite');

Rx.Observable.of(1)
	.repeat(2.5)
	.subscribe(i => console.log('onnext: ' + i));

Expected behavior:

Either throw an error, or repeat 2, or 3 times.

Actual behavior:

Repeats infinitely, logs:

onnext: 1
onnext: 1
onnext: 1
onnext: 1
...etc, infinitely

Additional information:

I understand that it doesn't make so much sense to pass a non natural number to repeat. In our case, the repeat count was calculated dynamically, which made it unclear that this was an issue.

I realize this isn't a problem in later (or "non-lite") versions, just leaving this info here for future googlers.

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