Bynder / gathercontent-gathercontent.js

A Javascript library for getting content from GatherContent.
https://gathercontent.com/
MIT License
2 stars 2 forks source link

GetProjectData: retries after hitting rate limit fail with 429 response code #3

Closed ctmm closed 2 years ago

ctmm commented 2 years ago

Hi,

According to the API documentation, we're limited to 250 requests per 15 seconds

This is reflected on the code introduced by #2

However, while using this package on a larger project, our team encountered issues. It seems the "retry" or the "throttling" strategy for requests isn't matching what the API allows resulting in a failure to fetch the project data.

Increasing the retry timeout to 1 second + increasing the rate limit to 16 seconds seems to fix the issue. Still, I'm unsure if it's a proper fix.

Any chance we could get some help with this topic?


Current behaviour:

Expected behaviour:

Environment:

Affected version: 1.0.0

kyleharper commented 2 years ago

Thanks again, your PR has been merged and released.

https://github.com/gathercontent/gathercontent.js/releases/tag/v1.0.1

kyleharper commented 2 years ago

@ctmm

I forgot to add more context but your changes made sense to me.

I imagine you were experiencing issues because the config was too exact making 250 requests per 15 seconds is in theory ok but timings etc are never an exact science so adding the buffer as you have may resolve your issue.

If you still experience problems, let me know and I'll reopen the issue and I'll have a closer look myself 👍

ctmm commented 2 years ago

@kyleharper, thank you for your help!