Reactive-Extensions / RxJS

The Reactive Extensions for JavaScript
http://reactivex.io
Other
19.48k stars 2.1k forks source link

Implement rate limit #1428

Open AlexSenchenko opened 7 years ago

AlexSenchenko commented 7 years ago

Hi @mattpodwysocki !

I have a cold observable with 1000000 items - array, and want to make HTTP calls with rate 10 per sec.

How to achieve this by standard way?

lukashavrlant commented 7 years ago

What about this way? (http://jsfiddle.net/8zk4ovxc/236/)

Rx.Observable.zip(
    Rx.Observable.from("abcdefghijklmopqrstuvwyz"),
    Rx.Observable.interval(100)
)
.subscribe(function([message]) {
    console.log(`${message} ${Date.now()}\n`);
});