right_agent 0.9.6 → 0.9.7
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.
- data/lib/right_agent/dispatcher.rb +5 -1
- data/right_agent.gemspec +2 -2
- data/spec/dispatcher_spec.rb +12 -0
- metadata +4 -4
@@ -209,7 +209,11 @@ module RightScale
|
|
209
209
|
@pending_dispatches += 1
|
210
210
|
@last_request_dispatch_time = received_at.to_i
|
211
211
|
@dispatched.store(token) if @dup_check && !shared && request.kind_of?(Request) && token
|
212
|
-
actor.
|
212
|
+
if actor.method(method).arity == 1
|
213
|
+
actor.__send__(method, request.payload)
|
214
|
+
else
|
215
|
+
actor.__send__(method, request.payload, request)
|
216
|
+
end
|
213
217
|
rescue Exception => e
|
214
218
|
@pending_dispatches = [@pending_dispatches - 1, 0].max
|
215
219
|
handle_exception(actor, method, request, e)
|
data/right_agent.gemspec
CHANGED
@@ -24,8 +24,8 @@ require 'rubygems'
|
|
24
24
|
|
25
25
|
Gem::Specification.new do |spec|
|
26
26
|
spec.name = 'right_agent'
|
27
|
-
spec.version = '0.9.
|
28
|
-
spec.date = '2012-
|
27
|
+
spec.version = '0.9.7'
|
28
|
+
spec.date = '2012-04-04'
|
29
29
|
spec.authors = ['Lee Kirchhoff', 'Raphael Simon', 'Tony Spataro']
|
30
30
|
spec.email = 'lee@rightscale.com'
|
31
31
|
spec.homepage = 'https://github.com/rightscale/right_agent'
|
data/spec/dispatcher_spec.rb
CHANGED
@@ -35,6 +35,10 @@ class Foo
|
|
35
35
|
['hello', payload]
|
36
36
|
end
|
37
37
|
|
38
|
+
def bar2(payload, request)
|
39
|
+
['hello', payload, request]
|
40
|
+
end
|
41
|
+
|
38
42
|
def i_kill_you(payload)
|
39
43
|
raise RuntimeError.new('I kill you!')
|
40
44
|
end
|
@@ -192,6 +196,14 @@ describe "RightScale::Dispatcher" do
|
|
192
196
|
res.results.should == ['hello', 'you']
|
193
197
|
end
|
194
198
|
|
199
|
+
it "should dispatch a request with required arity" do
|
200
|
+
req = RightScale::Request.new('/foo/bar2', 'you', :token => 'token')
|
201
|
+
res = @dispatcher.dispatch(req)
|
202
|
+
res.should(be_kind_of(RightScale::Result))
|
203
|
+
res.token.should == 'token'
|
204
|
+
res.results.should == ['hello', 'you', req]
|
205
|
+
end
|
206
|
+
|
195
207
|
it "should dispatch a request to the default action" do
|
196
208
|
req = RightScale::Request.new('/foo', 'you', :token => 'token')
|
197
209
|
res = @dispatcher.dispatch(req)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 7
|
10
|
+
version: 0.9.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lee Kirchhoff
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-
|
20
|
+
date: 2012-04-04 00:00:00 -07:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|