riaction 1.2.5 → 1.2.6

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/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  pkg/*
2
+ db/riaction.db
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG #
2
2
 
3
+ ## 1.2.6 ##
4
+
5
+ * resque jobs will re-enqeue on a timeout error
6
+
3
7
  ## 1.2.5 ##
4
8
 
5
9
  * fixing bug with optional display name argument in profiles
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- riaction (1.2.2)
4
+ riaction (1.2.6)
5
5
  activerecord (>= 3.0.0)
6
6
  activesupport (>= 3.0.0)
7
7
  rake
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011-2012 Christopher Eberz
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file
@@ -26,7 +26,7 @@ module Riaction
26
26
  # event_object no longer exists; no means to recover
27
27
  rescue IActionable::Error::BadRequest => e
28
28
  # Log event should never throw this as of IActionable API v3
29
- rescue IActionable::Error::Internal => e
29
+ rescue IActionable::Error::Internal, Faraday::Error::TimeoutError, Timeout::Error => e
30
30
  # upon an intenal error from IActionable, retry some set number of times by requeueing the task through Resque
31
31
  # after the max number of attempts, re-raise
32
32
  if attempt < ::Riaction::Constants.retry_attempts_for_internal_error
@@ -27,7 +27,7 @@ module Riaction
27
27
  rescue IActionable::Error::BadRequest => e
28
28
  # This should only be thrown if the profile type names specified in the model don't match what's on IActionable's dashboard
29
29
  raise e
30
- rescue IActionable::Error::Internal => e
30
+ rescue IActionable::Error::Internal, Faraday::Error::TimeoutError, Timeout::Error => e
31
31
  # upon an intenal error from IActionable, retry some set number of times by requeueing the task through Resque
32
32
  # after the max number of attempts, re-raise
33
33
  if attempt < ::Riaction::Constants.retry_attempts_for_internal_error
@@ -1,3 +1,3 @@
1
1
  module Riaction
2
- VERSION = "1.2.5"
2
+ VERSION = "1.2.6"
3
3
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib", "spec"]
20
20
 
21
21
 
22
- s.add_development_dependency "rspec", ">= 2.6"
22
+ s.add_development_dependency "rspec", ">= 2.8"
23
23
  s.add_development_dependency "sqlite3"
24
24
  s.add_development_dependency "ruby-debug19"
25
25
 
@@ -224,6 +224,36 @@ describe "sending an event to IActionable from the name of a riaction class and
224
224
  ::Riaction::EventPerformer.perform(:make_a_comment, 'Comment', @comment.id)
225
225
  end
226
226
  end
227
+
228
+ describe "when the call to IActionable, through API wrapper, times out" do
229
+ before do
230
+ @api.stub!(:log_event).and_raise(Timeout::Error)
231
+ Comment.class_eval do
232
+ riaction :event, :name => :make_a_comment, :trigger => :create, :profile => :user, :profile_type => :npc, :params => {:foo => 'bar'}
233
+ end
234
+ @comment = Comment.riactionless{ Comment.create(:user_id => @user.id, :content => 'this is a comment') }
235
+ end
236
+
237
+ it "should re-enqueue the job with an attempt count" do
238
+ Resque.should_receive(:enqueue).once.with(Riaction::EventPerformer, :make_a_comment, 'Comment', @comment.id, 1)
239
+ ::Riaction::EventPerformer.perform(:make_a_comment, 'Comment', @comment.id)
240
+ end
241
+ end
242
+
243
+ describe "when the call to IActionable, through API wrapper, times out with a faraday-wrapped timeout" do
244
+ before do
245
+ @api.stub!(:log_event).and_raise(Faraday::Error::TimeoutError.new(""))
246
+ Comment.class_eval do
247
+ riaction :event, :name => :make_a_comment, :trigger => :create, :profile => :user, :profile_type => :npc, :params => {:foo => 'bar'}
248
+ end
249
+ @comment = Comment.riactionless{ Comment.create(:user_id => @user.id, :content => 'this is a comment') }
250
+ end
251
+
252
+ it "should re-enqueue the job with an attempt count" do
253
+ Resque.should_receive(:enqueue).once.with(Riaction::EventPerformer, :make_a_comment, 'Comment', @comment.id, 1)
254
+ ::Riaction::EventPerformer.perform(:make_a_comment, 'Comment', @comment.id)
255
+ end
256
+ end
227
257
 
228
258
  describe "when the arguments passed to perform() are all strings" do
229
259
  before do
@@ -126,6 +126,36 @@ describe "automatic profile creation from riaction definitions:" do
126
126
  ::Riaction::ProfileCreator.perform('User', @user.id, 0)
127
127
  end
128
128
  end
129
+
130
+ describe "when the call to IActionable, through API wrapper, times out" do
131
+ before do
132
+ @api.stub!(:create_profile).and_raise(Timeout::Error)
133
+ User.class_eval do
134
+ riaction :profile, :type => :player, :custom => :id, :username => :name
135
+ end
136
+ @user = User.riactionless{ User.create(:name => 'zortnac') }
137
+ end
138
+
139
+ it "should re-enqueue the job with an attempt count" do
140
+ Resque.should_receive(:enqueue).once.with(Riaction::ProfileCreator, "User", @user.id, 1)
141
+ ::Riaction::ProfileCreator.perform('User', @user.id, 0)
142
+ end
143
+ end
144
+
145
+ describe "when the call to IActionable, through API wrapper, times out with a faraday-wrapped timeout" do
146
+ before do
147
+ @api.stub!(:create_profile).and_raise(Faraday::Error::TimeoutError.new(""))
148
+ User.class_eval do
149
+ riaction :profile, :type => :player, :custom => :id, :username => :name
150
+ end
151
+ @user = User.riactionless{ User.create(:name => 'zortnac') }
152
+ end
153
+
154
+ it "should re-enqueue the job with an attempt count" do
155
+ Resque.should_receive(:enqueue).once.with(Riaction::ProfileCreator, "User", @user.id, 1)
156
+ ::Riaction::ProfileCreator.perform('User', @user.id, 0)
157
+ end
158
+ end
129
159
 
130
160
  describe "when the arguments passed to perform are all strings" do
131
161
  before do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-01 00:00:00.000000000Z
12
+ date: 2012-03-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2153231200 !ruby/object:Gem::Requirement
16
+ requirement: &2165342760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '2.6'
21
+ version: '2.8'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2153231200
24
+ version_requirements: *2165342760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &2153230660 !ruby/object:Gem::Requirement
27
+ requirement: &2165342180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2153230660
35
+ version_requirements: *2165342180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ruby-debug19
38
- requirement: &2153230200 !ruby/object:Gem::Requirement
38
+ requirement: &2165341600 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2153230200
46
+ version_requirements: *2165341600
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &2153229780 !ruby/object:Gem::Requirement
49
+ requirement: &2165341020 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2153229780
57
+ version_requirements: *2165341020
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activerecord
60
- requirement: &2153229260 !ruby/object:Gem::Requirement
60
+ requirement: &2165340240 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 3.0.0
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2153229260
68
+ version_requirements: *2165340240
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
- requirement: &2153228760 !ruby/object:Gem::Requirement
71
+ requirement: &2165339740 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 3.0.0
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2153228760
79
+ version_requirements: *2165339740
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: resque
82
- requirement: &2153228380 !ruby/object:Gem::Requirement
82
+ requirement: &2165339280 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *2153228380
90
+ version_requirements: *2165339280
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: ruby-iactionable
93
- requirement: &2153227800 !ruby/object:Gem::Requirement
93
+ requirement: &2165338400 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: 0.0.2
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *2153227800
101
+ version_requirements: *2165338400
102
102
  description: Wrapper for IActionable's restful API and an "acts-as" style interface
103
103
  for models to behave as profiles and drive game events.
104
104
  email:
@@ -111,6 +111,7 @@ files:
111
111
  - CHANGELOG.md
112
112
  - Gemfile
113
113
  - Gemfile.lock
114
+ - MIT-LICENSE.txt
114
115
  - README.md
115
116
  - Rakefile
116
117
  - db/riaction.db