swift-storage 0.0.9 → 0.0.10

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: 4df7d503d429d4016d37c4fd440d39eed1c4b30d
4
- data.tar.gz: 66bb39377d3493c4d028c2d166c686c1e5da8821
3
+ metadata.gz: da14f122449c3a28046bdde2a55627d9786063b5
4
+ data.tar.gz: 7c3d4bbdb737640d475d0d5f23c9749db619abb3
5
5
  SHA512:
6
- metadata.gz: b850b928deca95b0ac052c49a19c905ca229d1832fdeb86b83157f2564b05cd15d9f1455f5578ad41d687cbeba3bc0e20484db141ccaeb4721a9a1ab5e43c7c6
7
- data.tar.gz: caac9b19dd0788d241d934d65d76545765a7d1de06217bddda83d1fb77e50208ad5052d7f6a1b87603a3442bfeff54832ff66eb2e0c418bc8d5f13b0c9c3d872
6
+ metadata.gz: 445875d4a6c9b8a2bae8723ee8f181a8bf07bc4ad6fe81d6229ca6d69c756a12e893a1580c3a0069f899e6ef7428865d644f29c604b8dbe34c0ab4a03ff8b24b
7
+ data.tar.gz: 472938b6204624e0ba9797b150f39025ce56a625d2f3e94be781ca51e8f2cbef7f568591c96a0dc123ba212001749b7701cfbc33c4e1d68d26231ac978070670
@@ -3,10 +3,16 @@
3
3
  This file is written in reverse chronological order, newer releases will
4
4
  appear at the top.
5
5
 
6
+ ## 0.0.10
7
+
8
+ * Retry on connection error before giving up
9
+ [#11](https://github.com/memoways/swift-ruby/pull/11)
10
+ @ArmandPredicSis
11
+
6
12
  ## 0.0.9
7
13
 
8
14
  * Allow upload of large file (>5GB)
9
- [#9](https://github.com/memoways/swift-ruby/pull/10)
15
+ [#10](https://github.com/memoways/swift-ruby/pull/10)
10
16
  @ArmandPredicSis
11
17
 
12
18
  ## 0.0.8
@@ -1,7 +1,7 @@
1
1
  module SwiftStorage
2
2
  class Configuration
3
3
  attr_accessor :auth_version, :tenant, :username, :password, :endpoint, :temp_url_key,
4
- :auth_method, :authtenant_type
4
+ :auth_method, :authtenant_type, :retries
5
5
 
6
6
  def initialize
7
7
  @auth_version = ENV['SWIFT_STORAGE_AUTH_VERSION'] || '1.0'
@@ -10,6 +10,7 @@ module SwiftStorage
10
10
  @password = ENV['SWIFT_STORAGE_PASSWORD']
11
11
  @endpoint = ENV['SWIFT_STORAGE_ENDPOINT']
12
12
  @temp_url_key = ENV['SWIFT_STORAGE_TEMP_URL_KEY']
13
+ @retries = 3
13
14
 
14
15
  @auth_method = :password
15
16
  @authtenant_type = 'tenantName' # `tenantName` or `tenantId`
@@ -20,14 +20,17 @@ class SwiftStorage::Service
20
20
  :storage_host,
21
21
  :storage_port,
22
22
  :storage_path,
23
- :temp_url_key
23
+ :temp_url_key,
24
+ :retries
24
25
 
25
26
  def initialize(tenant: configuration.tenant,
26
27
  username: configuration.username,
27
28
  password: configuration.password,
28
29
  endpoint: configuration.endpoint,
29
- temp_url_key: configuration.temp_url_key)
30
+ temp_url_key: configuration.temp_url_key,
31
+ retries: configuration.retries)
30
32
  @temp_url_key = temp_url_key
33
+ @retries = retries
31
34
 
32
35
  %w(tenant username password endpoint).each do |n|
33
36
  eval("#{n} or raise ArgumentError, '#{n} is required'")
@@ -116,6 +119,9 @@ class SwiftStorage::Service
116
119
  json_data: nil,
117
120
  input_stream: nil,
118
121
  output_stream: nil)
122
+
123
+ tries = retries
124
+
119
125
  headers ||= {}
120
126
  headers.merge!(Headers::AUTH_TOKEN => auth_token) if authenticated?
121
127
  headers.merge!(Headers::CONTENT_TYPE => 'application/json') if json_data
@@ -183,7 +189,15 @@ class SwiftStorage::Service
183
189
  end
184
190
  end
185
191
 
186
- response = s.request(req, &output_proc)
192
+ begin
193
+ response = s.request(req, &output_proc)
194
+ rescue Errno::EPIPE, Errno::EAGAIN, Errno::EWOULDBLOCK, Timeout::Error, Errno::EINVAL, EOFError
195
+ # Server closed the connection, retry
196
+ sleep 5
197
+ retry unless (tries -= 1) <= 0
198
+ raise OpenStack::Exception::Connection, "Unable to connect to OpenStack::Swift after #{retries} retries"
199
+ end
200
+
187
201
  begin
188
202
  check_response!(response)
189
203
  rescue AuthError
@@ -1,3 +1,3 @@
1
1
  module SwiftStorage
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swift-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Goy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-07 00:00:00.000000000 Z
11
+ date: 2015-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler