watermarkchurch / wcc-contentful

An alternative to Contentful's contentful.rb ruby client, contentful_model, and contentful_rails gems all in one.
MIT License
2 stars 1 forks source link

Handle rate limits and 503 service unavailable from Contentful CDN #37

Closed gburgett closed 5 years ago

gburgett commented 6 years ago

https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/api-rate-limits

The gem should handle the following response at the SimpleClient level:

HTTP/1.1 429
X-Contentful-RateLimit-Reset: 1

The gem should then block all threads from making new queries until the reset period has elapsed. The request that caused the 429 response should also be retried.

gburgett commented 6 years ago

While we're at it we should also automatically retry on 503s, which we seem to get occasionally in JTJ

gburgett commented 5 years ago

@frizman21 https://app.bugsnag.com/watermark-community-church/paper-signs/errors/5d83f724d818e100196d61d7?event_id=5d83f7240050405a411d0000&i=sk&m=nw

Happened in fort-worth environment today

frizman21 commented 5 years ago

Please investigate.

gburgett commented 5 years ago

Oh man this is probably them tooting around in preview mode! We totally skip the cache in preview mode and always hit the CDN directly. We can optimize this...