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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83cdb2541d4d694624f06d63e03dce612db88ce09e0ff7532c4d701424aedb46
4
- data.tar.gz: a3862e1f9f6f4f1685ab2c7c8077e4a166ab3ebfa8a017fb32aa701d7dc68705
3
+ metadata.gz: dbf74dcbe416b443f5822de5e4dc5244b5448184263b9956329cb6c1129870ed
4
+ data.tar.gz: 58f39eb8e256d379360452dcc60debe784d5817d74f2215dae9b1f30a5c2d6ac
5
5
  SHA512:
6
- metadata.gz: 1e8f5628d633564aaf0183a89ebebb9e9c4ee82d298d2deee8513b26dd5f8a52326ce57278c3f9782986def685212995f034a3e18d65321a34081689d248ca2a
7
- data.tar.gz: 3792fa6710c0e4fcca018ad96464772d5776864bea0fc19e2c493bd871a9008eb09f6a675892008df4b9fe8454cdda66eca8a0e09d38dee5018428c8fa985b49
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:
@@ -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 config.retry
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
- DEFAULT_RETRY_OPTIONS.merge(config.retry_options) do |key, default_val, new_val|
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
@@ -1,5 +1,5 @@
1
1
  module We
2
2
  module Call
3
- VERSION = '0.9.1'
3
+ VERSION = '0.12.0'
4
4
  end
5
5
  end
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.9.1
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-24 00:00:00.000000000 Z
11
+ date: 2020-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus