we-call 0.9.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +6 -0
- data/lib/we/call/connection.rb +11 -4
- data/lib/we/call/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbf74dcbe416b443f5822de5e4dc5244b5448184263b9956329cb6c1129870ed
|
4
|
+
data.tar.gz: 58f39eb8e256d379360452dcc60debe784d5817d74f2215dae9b1f30a5c2d6ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0875da2fd0d502d5eceaf7f9121242adee5ac7884854edf6bddcd75b06572286e86520e39af3c6ef7a9ad46eec9e7f06c1ee52370bc8b3d5d2ca75549fed8da0'
|
7
|
+
data.tar.gz: 37068e825ace749bfdb15165df035024ccd541278b2fa4f1911e307c1ecfbc1cedf298db41c2df5f365b1fe45cec30a60612338c6206c31205ee511b0d715457
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
7
|
|
8
|
+
## [v0.12.0] - 2020-12-17
|
9
|
+
### Added
|
10
|
+
- Bump version to fix incorrect tag
|
11
|
+
|
12
|
+
## [v0.11.0] - 2020-12-08
|
13
|
+
### Added
|
14
|
+
- Allow to set retry options on a connection([#36])
|
15
|
+
|
16
|
+
|
8
17
|
## [v0.9.1] - 2020-11-20
|
9
18
|
### Added
|
10
19
|
- Automatically retry on network errors([#31])
|
data/README.md
CHANGED
@@ -112,6 +112,9 @@ Disable the middleware:
|
|
112
112
|
We::Call.configure do |config|
|
113
113
|
config.retry = false
|
114
114
|
end
|
115
|
+
|
116
|
+
# Provided at initialization
|
117
|
+
connection = We::Call::Connection.new(retry_options: false)
|
115
118
|
```
|
116
119
|
|
117
120
|
Adjust the middleware:
|
@@ -120,6 +123,9 @@ Adjust the middleware:
|
|
120
123
|
We::Call.configure do |config|
|
121
124
|
config.retry_options = { interval: 0.5 }
|
122
125
|
end
|
126
|
+
|
127
|
+
# Provided at initialization
|
128
|
+
connection = We::Call::Connection.new(retry_options: { interval: 0.5 })
|
123
129
|
```
|
124
130
|
|
125
131
|
The gem smartly merges the options passed, so you can specify your own list of exceptions without being afraid to override the default ones:
|
data/lib/we/call/connection.rb
CHANGED
@@ -46,8 +46,9 @@ module We
|
|
46
46
|
# @param [String] app
|
47
47
|
# @param [String] env
|
48
48
|
# @yieldparam [Faraday::Connection] Faraday connection object is yielded to a block
|
49
|
-
def new(host:, timeout: nil, open_timeout: OPEN_TIMEOUT, app: guess_app, env: guess_env, &block)
|
49
|
+
def new(host:, timeout: nil, open_timeout: OPEN_TIMEOUT, app: guess_app, env: guess_env, retry_options: {}, &block)
|
50
50
|
@host = host
|
51
|
+
@retry_options = retry_options
|
51
52
|
@app = app or raise_missing_app!
|
52
53
|
@env = env or raise_missing_env!
|
53
54
|
@timeout = timeout or raise_missing_timeout!
|
@@ -57,7 +58,7 @@ module We
|
|
57
58
|
|
58
59
|
private
|
59
60
|
|
60
|
-
attr_reader :app, :env, :host, :timeout, :open_timeout
|
61
|
+
attr_reader :app, :env, :host, :timeout, :open_timeout, :retry_options
|
61
62
|
|
62
63
|
# @return [Faraday::Connection] Preconfigured Faraday Connection object, for hitting get, post, etc.
|
63
64
|
def create
|
@@ -78,7 +79,7 @@ module We
|
|
78
79
|
if config.detect_deprecations
|
79
80
|
faraday.response :sunset, setup_sunset_middleware(faraday)
|
80
81
|
end
|
81
|
-
if
|
82
|
+
if should_retry?
|
82
83
|
faraday.request :retry, fetch_retry_options
|
83
84
|
end
|
84
85
|
|
@@ -127,8 +128,14 @@ module We
|
|
127
128
|
options
|
128
129
|
end
|
129
130
|
|
131
|
+
def should_retry?
|
132
|
+
retry_options.any? || config.retry
|
133
|
+
end
|
134
|
+
|
130
135
|
def fetch_retry_options
|
131
|
-
|
136
|
+
client_options = retry_options.any? ? retry_options : config.retry_options
|
137
|
+
|
138
|
+
DEFAULT_RETRY_OPTIONS.merge(client_options) do |key, default_val, new_val|
|
132
139
|
if key == :exceptions
|
133
140
|
default_val + Array(new_val)
|
134
141
|
else
|
data/lib/we/call/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: we-call
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WeWork Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|