cloud-queues 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -75,7 +75,7 @@ module CloudQueues
75
75
  @client = Excon.new(@api_host, tcp_nodelay: true)
76
76
  end
77
77
 
78
- def request(options = {}, second_try = false)
78
+ def request(options = {}, second_try = [])
79
79
  if options[:body] and options[:body].class != String
80
80
  options[:body] = options[:body].to_json
81
81
  end
@@ -96,20 +96,20 @@ module CloudQueues
96
96
  begin
97
97
  response = @client.request(options)
98
98
  rescue Excon::Errors::SocketError => e
99
- raise unless e.message.include?("EOFError") or second_try
99
+ raise unless e.message.include?("EOFError") or second_try.include?(:socketerror)
100
100
 
101
101
  # this happens when the server closes the keep-alive socket and
102
102
  # Excon doesn't realize it yet.
103
103
  @client.reset
104
- return request(options, true)
104
+ return request(options, second_try + [:socketerror])
105
105
  rescue Excon::Errors::Unauthorized => e
106
- raise if second_try or @token.nil?
106
+ raise if second_try.include?(:unauth) or @token.nil?
107
107
 
108
108
  # Our @token probably expired, re-auth and try again
109
109
  @token = nil
110
110
  authenticate!
111
111
  @client.reset # for good measure
112
- return request(options, true)
112
+ return request(options, second_try + [:unauth])
113
113
  end
114
114
 
115
115
  begin
@@ -1,3 +1,3 @@
1
1
  module CloudQueues
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud-queues
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-04 00:00:00.000000000 Z
12
+ date: 2014-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon