knapsack_pro 0.18.0 → 0.19.0

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
  SHA1:
3
- metadata.gz: 776a8b23ab2904168e0045473328847f98cf33ba
4
- data.tar.gz: de729e204e176211b212fcbcbcd9b1962cc5b753
3
+ metadata.gz: c11586bb78f84d7cf17f4777450e10e93d0b0b08
4
+ data.tar.gz: 47d8e142789e12bae228be825f3f9788a03487d7
5
5
  SHA512:
6
- metadata.gz: e6e5a91f7d9acd006da5c5b5b37039f3aaf7bc180be673fb764fb4859495cc839d0d78d4f146bfdfd515b0cca8ac8dddb275440909b6046d22e5c1b2dd775fee
7
- data.tar.gz: d17eca6592fcaf86c104d42b88aae035fc3ad7b4dfb058f35d984f2452455a1811f2255c46ffe40bfa4a79455eef952d9e58494577a24e6f8e4e392dd64fa6af
6
+ metadata.gz: '0659bed3a7b0be304089b764e528938bc664d9698c39585eac1cc6b1f7df4f79a46e15722f1196b54d753d4d2a7c9182c9f0fec3eb2e3fb5cae76a85d1b3885f'
7
+ data.tar.gz: 0366b18ab1098eed6fcfeab6a72b0c04fd9382d5aeef6ff02f6051c73449df9c2cd1cfef4939b75b3503ce0d395655145c0a8fa5b733acdbdc9322c746c71e5d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 0.19.0
6
+
7
+ * Change timeout to 30s for requests to API.
8
+ * Retry failed request to API at most 3 times.
9
+
5
10
  ### 0.18.0
6
11
 
7
12
  * Add support for knapsack_pro queue mode
@@ -1,7 +1,7 @@
1
1
  module KnapsackPro
2
2
  module Client
3
3
  class Connection
4
- TIMEOUT = 15
4
+ TIMEOUT = 30
5
5
 
6
6
  def initialize(action)
7
7
  @action = action
@@ -75,6 +75,7 @@ module KnapsackPro
75
75
  end
76
76
 
77
77
  def post
78
+ retries ||= 0
78
79
  uri = URI.parse(endpoint_url)
79
80
  http = Net::HTTP.new(uri.host, uri.port)
80
81
  http.use_ssl = (uri.scheme == 'https')
@@ -98,6 +99,7 @@ module KnapsackPro
98
99
  response
99
100
  rescue Errno::ECONNREFUSED, EOFError, SocketError, Net::OpenTimeout, Net::ReadTimeout => e
100
101
  logger.warn(e.inspect)
102
+ retry if (retries += 1) < 3
101
103
  end
102
104
  end
103
105
  end
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '0.18.0'
2
+ VERSION = '0.19.0'
3
3
  end
@@ -30,8 +30,8 @@ describe KnapsackPro::Client::Connection do
30
30
  expect(Net::HTTP).to receive(:new).with('api.knapsackpro.dev', 3000).and_return(http)
31
31
 
32
32
  expect(http).to receive(:use_ssl=).with(false)
33
- expect(http).to receive(:open_timeout=).with(15)
34
- expect(http).to receive(:read_timeout=).with(15)
33
+ expect(http).to receive(:open_timeout=).with(30)
34
+ expect(http).to receive(:read_timeout=).with(30)
35
35
 
36
36
  header = { 'X-Request-Id' => 'fake-uuid' }
37
37
  http_response = instance_double(Net::HTTPOK, body: body, header: header)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-15 00:00:00.000000000 Z
11
+ date: 2017-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake