faraday-retry 2.3.0 → 2.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af805c058f1e08fba4ab4c53587f88906f086f06bda02dd4daf578123d6aa79f
4
- data.tar.gz: 714eeaadf0d8021d7c33f86ece4dda66366fcc6525e8bf395c3e71591d0a8bc2
3
+ metadata.gz: 7e0d25040c1d5a44f97588ae549113ddc1f5605575982a9914bbcf04ba75479e
4
+ data.tar.gz: 9894f02b5c148166cf87eba7b80399ab52d6ab52d62a754c7cdb923cb77b55d6
5
5
  SHA512:
6
- metadata.gz: 6de30437afefef5b6887a0c7b2e72615775b63a92aaee63c37672631d9e09011b0b46fa9c208e6ca280d55ace287e12c9077ed18107968bc5593255cd028b6c1
7
- data.tar.gz: dc0e7f4b11e714addd9a11426cc5071eb2245ea8f5cb24a38e7f63ee50030df81b14380912b4f0b786f9bfa53dfeccbc16f802337638054d7e36ad56be667f3f
6
+ metadata.gz: 6166b5f81ddc21739eb1654a2e8aa55191ecb275f4299d752980df1b7220c7698703fadeee074454da963ca0877dd00283105f0e1f423e6043735f042c984ea2
7
+ data.tar.gz: c6e11e52b1007c9dc6bca895b89a06638b4269bc7f19f89d5916e6c81136958c49f2095dd6cc8bc2e1391ba4dcd47d5879931cdf19a68a8f0608a0e11c82bc05
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Faraday Retry
2
2
 
3
- [![CI](https://github.com/lostisland/faraday-retry/actions/workflows/ci.yaml/badge.svg)](https://github.com/lostisland/faraday-retry/actions/workflows/ci.yaml)
3
+ [![CI](https://github.com/lostisland/faraday-retry/actions/workflows/ci.yml/badge.svg)](https://github.com/lostisland/faraday-retry/actions/workflows/ci.yml)
4
4
  [![Gem](https://img.shields.io/gem/v/faraday-retry.svg?style=flat-square)](https://rubygems.org/gems/faraday-retry)
5
5
  [![License](https://img.shields.io/github/license/lostisland/faraday-retry.svg?style=flat-square)](LICENSE.md)
6
6
 
@@ -1,44 +1,46 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Adds the ability to retry a request based on settings and errors that have occurred.
4
- module Retryable
5
- def with_retries(env:, options:, retries:, body:, errmatch:)
6
- yield
7
- rescue errmatch => e
8
- exhausted_retries(options, env, e) if retries_zero?(retries, env, e)
3
+ module Faraday
4
+ # Adds the ability to retry a request based on settings and errors that have occurred.
5
+ module Retryable
6
+ def with_retries(env:, options:, retries:, body:, errmatch:)
7
+ yield
8
+ rescue errmatch => e
9
+ exhausted_retries(options, env, e) if retries_zero?(retries, env, e)
9
10
 
10
- if retries.positive? && retry_request?(env, e)
11
- retries -= 1
12
- rewind_files(body)
13
- if (sleep_amount = calculate_sleep_amount(retries + 1, env))
14
- options.retry_block.call(
15
- env: env,
16
- options: options,
17
- retry_count: options.max - (retries + 1),
18
- exception: e,
19
- will_retry_in: sleep_amount
20
- )
21
- sleep sleep_amount
22
- retry
11
+ if retries.positive? && retry_request?(env, e)
12
+ retries -= 1
13
+ rewind_files(body)
14
+ if (sleep_amount = calculate_sleep_amount(retries + 1, env))
15
+ options.retry_block.call(
16
+ env: env,
17
+ options: options,
18
+ retry_count: options.max - (retries + 1),
19
+ exception: e,
20
+ will_retry_in: sleep_amount
21
+ )
22
+ sleep sleep_amount
23
+ retry
24
+ end
23
25
  end
24
- end
25
26
 
26
- raise unless e.is_a?(Faraday::RetriableResponse)
27
+ raise unless e.is_a?(Faraday::RetriableResponse)
27
28
 
28
- e.response
29
- end
29
+ e.response
30
+ end
30
31
 
31
- private
32
+ private
32
33
 
33
- def retries_zero?(retries, env, exception)
34
- retries.zero? && retry_request?(env, exception)
35
- end
34
+ def retries_zero?(retries, env, exception)
35
+ retries.zero? && retry_request?(env, exception)
36
+ end
36
37
 
37
- def exhausted_retries(options, env, exception)
38
- options.exhausted_retries_block.call(
39
- env: env,
40
- exception: exception,
41
- options: options
42
- )
38
+ def exhausted_retries(options, env, exception)
39
+ options.exhausted_retries_block.call(
40
+ env: env,
41
+ exception: exception,
42
+ options: options
43
+ )
44
+ end
43
45
  end
44
46
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Faraday
4
4
  module Retry
5
- VERSION = '2.3.0'
5
+ VERSION = '2.3.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-retry
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattia Giuffrida
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-03-30 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: faraday
@@ -158,11 +157,10 @@ licenses:
158
157
  - MIT
159
158
  metadata:
160
159
  bug_tracker_uri: https://github.com/lostisland/faraday-retry/issues
161
- changelog_uri: https://github.com/lostisland/faraday-retry/blob/v2.3.0/CHANGELOG.md
162
- documentation_uri: http://www.rubydoc.info/gems/faraday-retry/2.3.0
160
+ changelog_uri: https://github.com/lostisland/faraday-retry/blob/v2.3.2/CHANGELOG.md
161
+ documentation_uri: http://www.rubydoc.info/gems/faraday-retry/2.3.2
163
162
  homepage_uri: https://github.com/lostisland/faraday-retry
164
163
  source_code_uri: https://github.com/lostisland/faraday-retry
165
- post_install_message:
166
164
  rdoc_options: []
167
165
  require_paths:
168
166
  - lib
@@ -180,8 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
178
  - !ruby/object:Gem::Version
181
179
  version: '0'
182
180
  requirements: []
183
- rubygems_version: 3.1.6
184
- signing_key:
181
+ rubygems_version: 3.6.7
185
182
  specification_version: 4
186
183
  summary: Catches exceptions and retries each request a limited number of times
187
184
  test_files: []