Throttling
See original GitHub issueIs it possible to throttle a Stream by an “elements by second” values? Something like this:
seq { ... }
|> Stream.ofSeq
|> Stream.throttle (perSecond 20)
|> ...
No elements must be lost (i.e. it should do back pressure if incoming stream rate is bigger that needed).
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Throttling Definition & Meaning
The meaning of THROTTLING is the act or an instance of throttling something or someone. How to use throttling in a sentence.
Read more >Bandwidth throttling
Bandwidth throttling works by limiting (throttling) the speed at which a bandwidth intensive device (a server) receives data or the speed (i.e. bytes...
Read more >What is API Throttling?
API throttling is the process of limiting the number of API requests a user can make in a certain period. An application programming...
Read more >Throttle API requests for better throughput
Amazon API Gateway provides four basic types of throttling-related settings: AWS throttling limits are applied across all accounts and clients in a region....
Read more >THROTTLING | definition in the Cambridge English Dictionary
to press someone's throat very tightly so that they cannot breathe: informal Sometimes he annoys me so much that I could throttle him....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I added
Stream.duringEachfor the kind of throttling where you actually do want to roughly aim at a given average time per element. Here is an example:Running
test 20Lgives the following output:As you can see,
plaincompletes in (very) roughly 10 seconds,duringin roughly 20 seconds andafterin roughly 30 seconds. Elements take a random amount of time between 0 and 1 seconds to generate.Thanks, very cool! 😃