allow num=0 in ratelimit
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 145
- PR merge metrics
- No merged PRs in 30d
Description
Currently the ratelimit function allows for bursts to occur up to the `num` limit.
I suggest to allow `num=0` in the ratelimit function. This would delay every data event (including the first one) that goes through the stream but unlike throttle would not drop any events.
Background:
I am using a recursive structure based on @vqvu 's code in https://github.com/caolan/highland/issues/371#issuecomment-196115715
There is currently no easy way to rate limit the main call in that example (i.e. the readdir call in the example - imagine that readdir being an API with a strict rate limit).
Contributor guide
Research direction
Start by locating the ratelimit function and reviewing how it handles the num limit and the first data event. Confirm the behavior against the recursive rate-limiting use case described in the issue. Done means num=0 delays every event without dropping any, unlike throttle.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100