Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1 request per 5 seconds #1

Closed
ivasilov opened this issue Mar 31, 2015 · 4 comments
Closed

1 request per 5 seconds #1

ivasilov opened this issue Mar 31, 2015 · 4 comments
Assignees
Labels

Comments

@ivasilov
Copy link

Hey,

Thanks for making this! It really simplifies my code. I tried using it for Twitter Rate limiting, but I found the requestsPerSecond approach a bit lacking.
In the Twitter API case, a request needs to be sent every 5 seconds. I tried setting the requestsPerSecond to 0.2, but it didn't work, unfortunately.

@JMPerez JMPerez added the bug label Mar 31, 2015
@JMPerez JMPerez self-assigned this Mar 31, 2015
@JMPerez
Copy link
Owner

JMPerez commented Mar 31, 2015

You are right. Only integers are working at the moment.
I'm going to work on fixing it!

@JMPerez
Copy link
Owner

JMPerez commented Mar 31, 2015

The initial implementation tried to resolve promises in such a way that it would eventually converge in the requestsPerSecond value (roughly after 1 second). However this overcomplicates the code and forces to keep track of the time when a set of promises started.

I have simplified the code to just store the time when the last promise was started. This should fix this issue.

@JMPerez
Copy link
Owner

JMPerez commented Mar 31, 2015

Merged and published!

@ivasilov
Copy link
Author

Nice!! Works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants