active_utils 3.2.2 → 3.2.3

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: 6211b736c9e2eca5eecb46238d8ddf14993eff6e
4
- data.tar.gz: ae32f4daff45189f5689a1384332e28bd48c3e46
3
+ metadata.gz: 94da83eb1fea5bd3c0d87913c99b1a99362a2f1f
4
+ data.tar.gz: 787909897ac8cfa2460dc60c90010f1a991c8d21
5
5
  SHA512:
6
- metadata.gz: 7135845a5dc5cd1673ff1beaf85d7a81473614f8a1698e9064d44b83ecaade0e8057eb7346c2ac2d0a6142918a9e1caf4089064ded546e198378fbe82b836214
7
- data.tar.gz: 8dc33a076e05c93360ec9f2a78a0569c6fb168c9991577a6ff60257e7e0215792d929e58c7efdcf87721093ec8f56e864fa082e168892cc53d012226a8cbb8ef
6
+ metadata.gz: 4d7c25a185919b588e70142d824eaca3dabf36be30ea7e1f4f348ea37263bade5486b33622e5180a6130a4e70e2f8d60dbec2f3b6638cc4984ecd4f72dde2889
7
+ data.tar.gz: 15be3d94760b7e483d02fbbeb15d5552fa15d1d652bd4c4313c8cb19634842e7571b41ec4b7e0485bc532d436782313fecc936229afabb0ce20a3ad002b265b3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # ActiveUtils changelog
2
2
 
3
+ ### Version 3.2.3 (Nov. 21, 2016)
4
+ - Add the `:delay` option in `ActiveUtils::NetworkConnectionRetries`
5
+
6
+ ### Version 3.2.2 (Jul. 4, 2016)
7
+ - Add tests for Rails 5 support
8
+
9
+ ### Version 3.2.1 (Oct. 26, 2015)
10
+ - Add the malaysian currency code "RM" in `ActiveUtils::CurrencyCode`
11
+
3
12
  ### Version 3.2.0 (Oct. 13, 2015)
4
13
  - Add #uses_postal_codes? to `ActiveUtils::Country`
5
14
 
@@ -49,12 +49,18 @@ module ActiveUtils
49
49
  retries -= 1
50
50
 
51
51
  log_with_retry_details(options[:logger], initial_retries-retries, Time.now.to_f - request_start, e.message, options[:tag])
52
- retry unless retries.zero?
52
+ unless retries.zero?
53
+ Kernel.sleep(options[:delay]) if options[:delay]
54
+ retry
55
+ end
53
56
  raise ActiveUtils::ConnectionError, e.message
54
57
  rescue ActiveUtils::ConnectionError, ActiveUtils::InvalidResponseError => e
55
58
  retries -= 1
56
59
  log_with_retry_details(options[:logger], initial_retries-retries, Time.now.to_f - request_start, e.message, options[:tag])
57
- retry if (options[:retry_safe] || retry_safe) && !retries.zero?
60
+ if (options[:retry_safe] || retry_safe) && !retries.zero?
61
+ Kernel.sleep(options[:delay]) if options[:delay]
62
+ retry
63
+ end
58
64
  raise
59
65
  end
60
66
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveUtils
2
- VERSION = "3.2.2"
2
+ VERSION = "3.2.3"
3
3
  end
@@ -149,6 +149,24 @@ class NetworkConnectionRetriesTest < Minitest::Test
149
149
  end
150
150
  end
151
151
 
152
+ def test_delay_between_retries
153
+ @requester.expects(:post).times(2).raises(EOFError).then.returns(@ok)
154
+ Kernel.expects(sleep: 0.5)
155
+
156
+ retry_exceptions retry_safe: true, delay: 0.5 do
157
+ @requester.post
158
+ end
159
+ end
160
+
161
+ def test_no_delay_without_specified_option
162
+ @requester.expects(:post).times(2).raises(EOFError).then.returns(@ok)
163
+ Kernel.expects(sleep: 0.5).never
164
+
165
+ retry_exceptions retry_safe: true do
166
+ @requester.post
167
+ end
168
+ end
169
+
152
170
  def test_failure_with_ssl_certificate
153
171
  @requester.expects(:post).raises(OpenSSL::X509::CertificateError)
154
172
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-04 00:00:00.000000000 Z
11
+ date: 2016-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  requirements: []
151
151
  rubyforge_project: active_utils
152
- rubygems_version: 2.2.3
152
+ rubygems_version: 2.5.1
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Common utils used by active_merchant, active_fulfillment, and active_shipping