mastercoms / SlackMC

Link Slack to Minecraft!
MIT License
62 stars 11 forks source link

Rate limit checking #11

Closed mastercoms closed 9 years ago

mastercoms commented 9 years ago

If there are a lot of messages at once, Slack will rate limit us to 1 message per second. We can solve this by sending batch messages, when someone sends more than 1 chat message in a row within a short period of time, without being interrupted, we can collect their messages until they are interrupted or stop. Also, if we get a 429 too many requests response code, we can hold off on the messages for the rate limit cooldown to recharge.

Janmm14 commented 9 years ago

Maybe make a scheduled task that sends the messages every seconds and clears the message cache.

mastercoms commented 9 years ago

Yes, I like that idea, but how will we handle multiple usernames? A task per username? And even then, semantics and meanings would be off, as the messages and responses would not be at the same time or appropriate position.

mastercoms commented 9 years ago

Slack can handle rate limiting by itself. It is just assuming too much to make rate limiting handling ourselves, as network efficiency can fluctuate at different times, making timings hard to control when sending several batch messages at once.