faraday-throttler-rx 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/client.rb +1 -1
- data/lib/faraday_throttler/middleware.rb +3 -2
- data/lib/faraday_throttler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 010e832af2e263e60bc76346f22620976f8b0a9a169d916c9929a004909ec5c0
|
4
|
+
data.tar.gz: dc4043fe5b8a4333ef456981b2a8bc3d7ecef535aba2bb11471d6e3088639b8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99503113453a6c9107d68a5e1240cfb3507b1376fa1a7bb91fafd62949628326f2a9040d6c7047d4ca78ef1d31055244d3a35a958c3da7fcbc70c8c5c183d34e
|
7
|
+
data.tar.gz: c1eb7322b9240e8abc6ef153ee8aca7c4ca28fd878e9da984158b73ebd9fe9e83a1dd94ff6643a1ce1bf8fa60e07954f6c757a2dff85529b95e035d710ce7929
|
data/examples/client.rb
CHANGED
@@ -6,7 +6,7 @@ require 'faraday_throttler/redis_cache'
|
|
6
6
|
|
7
7
|
|
8
8
|
redis = Redis.new
|
9
|
-
cache = FaradayThrottler::RedisCache.new(redis: redis,
|
9
|
+
cache = FaradayThrottler::RedisCache.new(redis: redis, default_ttl: 60)
|
10
10
|
|
11
11
|
conn = Faraday.new(:url => 'http://localhost:9800') do |faraday|
|
12
12
|
# faraday.response :logger # log requests to STDOUT
|
@@ -105,10 +105,11 @@ module FaradayThrottler
|
|
105
105
|
release_request_stick(cache_key)
|
106
106
|
end
|
107
107
|
end
|
108
|
-
rescue Faraday::
|
109
|
-
if rate_limit_response_checker.call(e.response)
|
108
|
+
rescue Faraday::Error => e
|
109
|
+
if e.is_a?(Faraday::ClientError) && rate_limit_response_checker.call(e.response)
|
110
110
|
wait_and_replay_call(request_env, cache_key, start)
|
111
111
|
else
|
112
|
+
release_request_stick(cache_key)
|
112
113
|
raise e
|
113
114
|
end
|
114
115
|
end
|