alaingilbert / Turntable-API

Allows you to create bots for turntable.fm
http://alaingilbert.github.com/Turntable-API/
MIT License
317 stars 98 forks source link

Make at most 10 requests per second. Version 0.1 #122

Closed bboe closed 11 years ago

alaingilbert commented 11 years ago

I don't get the purpose of this ? I mean, why is it bad to send more then 10 requests by second ? What happend when there is an heartbeat comming in during the sleep time ?

bboe commented 11 years ago

I experience a number of dropped messages when I delete large playlists from my bot. By ratelimiting the api a bit (10 rps is still pretty fast) I manged to stop dropping messages.

All messages will still be received, though won't be handled until the bot wakes up. The bot sleeps at most 0.1 second so it shouldn't be an issue.

bboe commented 11 years ago

If you prefer, I can make the ratelimit configurable such that when it's zero there is no rate limiting.

alaingilbert commented 11 years ago

Ho, this is a limitation on the turntable.fm side. They limit the number of requests that a user can make on a lapse of time. I don't think we should enforce the bot to behave like this. (the configurable rate limit may be a good alternative.)

bboe commented 11 years ago

Added configurable rate limit (in constructor) and actually bumped the version.

alaingilbert commented 11 years ago

Awesome :)