dagger 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dagger.rb +23 -0
- data/lib/dagger/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: 6cc49c73a7df566bdb7ce4409c8ffbec30473189431b567ac3367b565115aef8
|
4
|
+
data.tar.gz: a6ddb73f492ca4e7976f4d543136973ae19bd40b5d9a94f8a821902ea55163c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 923f1402cb9233af4e4d30f969e7cbf57a0ce170dfbc6b128bb24bf52e934b413d8b50e3588ded1ba46fc849d51b03cbd07230be0ccea64695f5c8bb37bb1d2c
|
7
|
+
data.tar.gz: 965088cadb748076ad8ee031042459014143bf17f6142132aeb85af03512c28083f0ed9abc94db32539dcb7b0df10300464bee308e32f329ad17085f66d778bb
|
data/lib/dagger.rb
CHANGED
@@ -8,6 +8,7 @@ require 'base64'
|
|
8
8
|
module Dagger
|
9
9
|
|
10
10
|
REDIRECT_CODES = [301, 302, 303].freeze
|
11
|
+
DEFAULT_RETRY_WAIT = 5.freeze # seconds
|
11
12
|
DEFAULT_HEADERS = {
|
12
13
|
'Accept' => '*/*',
|
13
14
|
'User-Agent' => "Dagger/#{VERSION} (Ruby Net::HTTP Wrapper, like curl)"
|
@@ -88,6 +89,17 @@ module Dagger
|
|
88
89
|
end
|
89
90
|
|
90
91
|
@response = build_response(resp, data || resp.body)
|
92
|
+
|
93
|
+
rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EINVAL, Timeout::Error, \
|
94
|
+
SocketError, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, OpenSSL::SSL::SSLError => e
|
95
|
+
|
96
|
+
if retries = opts[:retries] and retries.to_i > 0
|
97
|
+
puts "Got #{e.class}! Retrying in a sec (#{retries} retries left)"
|
98
|
+
sleep (opts[:retry_wait] || DEFAULT_RETRY_WAIT)
|
99
|
+
get(uri, opts.merge(retries: retries - 1))
|
100
|
+
else
|
101
|
+
raise
|
102
|
+
end
|
91
103
|
end
|
92
104
|
|
93
105
|
def post(uri, data, options = {})
|
@@ -135,6 +147,17 @@ module Dagger
|
|
135
147
|
@http.start unless @http.started?
|
136
148
|
resp, data = @http.send(*args)
|
137
149
|
@response = build_response(resp, data || resp.body)
|
150
|
+
|
151
|
+
rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EINVAL, Timeout::Error, \
|
152
|
+
SocketError, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, OpenSSL::SSL::SSLError => e
|
153
|
+
|
154
|
+
if method.to_s.downcase != 'get' && retries = opts[:retries] and retries.to_i > 0
|
155
|
+
puts "Got #{e.class}! Retrying in a sec (#{retries} retries left)"
|
156
|
+
sleep (opts[:retry_wait] || DEFAULT_RETRY_WAIT)
|
157
|
+
request(method, uri, data, opts.merge(retries: retries - 1))
|
158
|
+
else
|
159
|
+
raise
|
160
|
+
end
|
138
161
|
end
|
139
162
|
|
140
163
|
def response
|
data/lib/dagger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomás Pollak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|