Skip to content

Instantly share code, notes, and snippets.

View etherealite's full-sized avatar

Etherealite etherealite

View GitHub Profile
@etherealite
etherealite / rate_limits.rb
Created January 17, 2016 22:53 — forked from jeffrafter/rate_limits.rb
Handle Shopify API rate limits
# https://docs.shopify.com/api/introduction/api-call-limit
module ActiveResource
# 429 Client Error
class RateLimitExceededError < ClientError # :nodoc:
end
class Connection
RATE_LIMIT_SLEEP_SECONDS = 20 # number of seconds to sleep (by sleeping 20 you reset the clock to get 40 fresh burst calls with the default 2 calls/sec)