shopify_api_rate_limiter 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e90c911f0de74607d1ab9baeb6544ca31e6431f
|
4
|
+
data.tar.gz: adaaf6350af34558329b6cb845b0c786307b317c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29254f53f4d9a0716b6a8edeae37f95647c1dca30bfd9e68c4c19f4a61a7ffa30e997d05ee38fa302ebf49434bb14f7544bfc9d0922f53357565bc2920628688
|
7
|
+
data.tar.gz: 45f896d133cacdff96f1cb37b877c129cd85628ec613e50999dc7cd29fb8f12b84eb470a670008eb6a4084d2c22779a5fccc6ec49e4edc136d3ff75619cd5766
|
@@ -1,4 +1,6 @@
|
|
1
1
|
module ShopifyApiRateLimiter
|
2
|
+
class DailySkuLimitError < ::ActiveResource::ClientError ; end
|
3
|
+
|
2
4
|
module ThrottledConnection
|
3
5
|
SHOPIFY_SLEEP_TIME = 0.5
|
4
6
|
|
@@ -11,7 +13,9 @@ module ShopifyApiRateLimiter
|
|
11
13
|
begin
|
12
14
|
super
|
13
15
|
rescue ActiveResource::ClientError => ex
|
14
|
-
if ex
|
16
|
+
if ex.response.body == '{"errors":{"product":["Daily SKU limit reached. Please try again later."]}}'
|
17
|
+
raise ShopifyApiRateLimiter::DailySkuLimitError, "Daily Sku Limit Reached for Shopify Admin API"
|
18
|
+
elsif ex&.response&.code&.to_s == '429'
|
15
19
|
ShopifyApiRateLimiter.logger.info "Shopify returned 429 (Rate Limit Exceeded). Sleeping #{SHOPIFY_SLEEP_TIME}..."
|
16
20
|
sleep(SHOPIFY_SLEEP_TIME)
|
17
21
|
retry
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_api_rate_limiter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Buehler
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.6.
|
78
|
+
rubygems_version: 2.6.14.3
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: Rate limits API requests to the Shopify API.
|