marcy-terui / serverless-alexa-skills

Manage your Alexa Skills with Serverless Framework
https://www.npmjs.com/package/serverless-alexa-skills
MIT License
71 stars 13 forks source link

Call the Alexa API in serial to avoid throttling #28

Open lukelafountaine opened 5 years ago

lukelafountaine commented 5 years ago

When you are supporting a larger number of skills, models, or locales, the number of Alexa API calls increases. The requests are often throttled because we are sending too many at once. If we send the requests in serial, we can avoid getting throttled.

Yes, it is slightly slower, but at least it doesn't fail.

I tried this change on a test skill that supports all 13 locales that Amazon supports. Without the delay, the API calls still occasionally fail. 200ms was the sweet spot where it doesn't fail, but it doesn't take too long either. It's a little bit of a guessing game as I can't find the actual request limit in the Alexa documentation.

This should resolve issue #26.