right_agent 2.4.4-x86-mingw32 → 2.4.5-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
@@ -206,7 +206,7 @@ module RightScale
|
|
206
206
|
when "terminating", "reconnecting" then [200, nil]
|
207
207
|
when "Errno::ETIMEDOUT" then [408, "Request timeout"]
|
208
208
|
when "Errno::ECONNREFUSED" then [503, "Connection refused"]
|
209
|
-
else [
|
209
|
+
else [504, (error && error.to_s) || "HTTP connection failure for #{verb.to_s.upcase}"]
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
@@ -45,6 +45,16 @@ module EventMachineSpawn
|
|
45
45
|
EM.next_tick(*args) { @fiber_pool ? @fiber_pool.spawn(&block) : yield }
|
46
46
|
end
|
47
47
|
|
48
|
+
def self.wait(seconds)
|
49
|
+
if @fiber_pool
|
50
|
+
fiber = Fiber.current
|
51
|
+
EM.add_timer(seconds) { fiber.resume }
|
52
|
+
Fiber.yield
|
53
|
+
else
|
54
|
+
sleep(seconds)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
48
58
|
def self.add_timer(*args, &block)
|
49
59
|
EM.add_timer(*args) { @fiber_pool ? @fiber_pool.spawn(&block) : yield }
|
50
60
|
end
|
@@ -67,4 +77,4 @@ module EventMachineSpawn
|
|
67
77
|
end
|
68
78
|
|
69
79
|
# Alias for EventMachineSpawn
|
70
|
-
EM_S = EventMachineSpawn
|
80
|
+
EM_S = EventMachineSpawn
|
data/right_agent.gemspec
CHANGED
@@ -25,8 +25,8 @@ require 'rbconfig'
|
|
25
25
|
|
26
26
|
Gem::Specification.new do |spec|
|
27
27
|
spec.name = 'right_agent'
|
28
|
-
spec.version = '2.4.
|
29
|
-
spec.date = '
|
28
|
+
spec.version = '2.4.5'
|
29
|
+
spec.date = '2015-01-28'
|
30
30
|
spec.authors = ['Lee Kirchhoff', 'Raphael Simon', 'Tony Spataro', 'Scott Messier']
|
31
31
|
spec.email = 'lee@rightscale.com'
|
32
32
|
spec.homepage = 'https://github.com/rightscale/right_agent'
|
@@ -253,15 +253,15 @@ describe RightScale::NonBlockingClient do
|
|
253
253
|
@request_options[:path].should == "/api/foo/bar"
|
254
254
|
end
|
255
255
|
|
256
|
-
it "converts connection errors to
|
257
|
-
@headers.http_status =
|
256
|
+
it "converts connection errors to 504 by default" do
|
257
|
+
@headers.http_status = 504
|
258
258
|
@response.should_receive(:errback).and_yield.once
|
259
259
|
@response.should_receive(:error).and_return(nil)
|
260
|
-
@fiber.should_receive(:resume).with(
|
261
|
-
flexmock(Fiber).should_receive(:yield).and_return([
|
260
|
+
@fiber.should_receive(:resume).with(504, "HTTP connection failure for GET").once
|
261
|
+
flexmock(Fiber).should_receive(:yield).and_return([504, "HTTP connection failure for GET"]).once
|
262
262
|
flexmock(EM::HttpRequest).should_receive(:new).with(@host, @connect_options).and_return(@request).once
|
263
263
|
lambda { @client.request(:get, @path, @host, @connect_options, @request_options) }.
|
264
|
-
should raise_error(RightScale::HttpExceptions::
|
264
|
+
should raise_error(RightScale::HttpExceptions::GatewayTimeout)
|
265
265
|
end
|
266
266
|
|
267
267
|
it "converts Errno::ETIMEDOUT error to 408 RequestTimeout" do
|
@@ -353,7 +353,7 @@ describe RightScale::NonBlockingClient do
|
|
353
353
|
it "stops polling if there is an error" do
|
354
354
|
@response.should_receive(:error).and_return("some error").once
|
355
355
|
@response.should_receive(:errback).and_yield.once
|
356
|
-
@fiber.should_receive(:resume).with(
|
356
|
+
@fiber.should_receive(:resume).with(504, "some error").once
|
357
357
|
@client.send(:poll_again, @fiber, @request, @request_options, @stop_at).should be true
|
358
358
|
end
|
359
359
|
|
@@ -408,12 +408,12 @@ describe RightScale::NonBlockingClient do
|
|
408
408
|
@client.send(:handle_error, :get, Errno::ECONNREFUSED).should == [503, "Connection refused"]
|
409
409
|
end
|
410
410
|
|
411
|
-
it "converts error to
|
412
|
-
@client.send(:handle_error, :get, "failed").should == [
|
411
|
+
it "converts error to 504 GatewayTimeout by default" do
|
412
|
+
@client.send(:handle_error, :get, "failed").should == [504, "failed"]
|
413
413
|
end
|
414
414
|
|
415
|
-
it "generates error message for
|
416
|
-
@client.send(:handle_error, :get, nil).should == [
|
415
|
+
it "generates error message for 504 GatewayTimeout if none specified" do
|
416
|
+
@client.send(:handle_error, :get, nil).should == [504, "HTTP connection failure for GET"]
|
417
417
|
end
|
418
418
|
end
|
419
419
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.5
|
5
5
|
prerelease:
|
6
6
|
platform: x86-mingw32
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: right_support
|
@@ -447,7 +447,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
447
447
|
version: '0'
|
448
448
|
segments:
|
449
449
|
- 0
|
450
|
-
hash:
|
450
|
+
hash: -1955218884392609250
|
451
451
|
requirements: []
|
452
452
|
rubyforge_project:
|
453
453
|
rubygems_version: 1.8.26
|