delayed_job_with_named_queues 2.0.7.5 → 2.0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/delayed/worker.rb +5 -1
- data/spec/worker_spec.rb +11 -0
- metadata +62 -64
data/lib/delayed/worker.rb
CHANGED
@@ -144,7 +144,11 @@ module Delayed
|
|
144
144
|
|
145
145
|
if job.payload_object.respond_to? :on_permanent_failure
|
146
146
|
say "Running on_permanent_failure hook"
|
147
|
-
|
147
|
+
begin
|
148
|
+
job.payload_object.on_permanent_failure
|
149
|
+
rescue Exception => error
|
150
|
+
say "#{job.name} on permanent failure callback failed with #{error.class.name}: #{error.message}", Logger::ERROR
|
151
|
+
end
|
148
152
|
end
|
149
153
|
|
150
154
|
self.class.destroy_failed_jobs ? job.destroy : job.update_attributes(:failed_at => Delayed::Job.db_time_now)
|
data/spec/worker_spec.rb
CHANGED
@@ -169,6 +169,17 @@ describe Delayed::Worker do
|
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
|
+
context "when the job's payload has an #on_permanent_failure hook and that hook raises an exception" do
|
173
|
+
before do
|
174
|
+
@job = Delayed::Job.create :payload_object => OnPermanentFailureJob.new
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should handle the exception" do
|
178
|
+
@job.payload_object.should_receive(:on_permanent_failure).and_raise("badness")
|
179
|
+
expect { @worker.reschedule(@job) }.to_not raise_error
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
172
183
|
context "when the job's payload has no #on_permanent_failure hook" do
|
173
184
|
# It's a little tricky to test this in a straightforward way,
|
174
185
|
# because putting a should_not_receive expectation on
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job_with_named_queues
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 127
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
9
|
- 7
|
10
|
-
-
|
11
|
-
version: 2.0.7.
|
10
|
+
- 6
|
11
|
+
version: 2.0.7.6
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Ray Walters
|
@@ -17,13 +17,10 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-
|
21
|
-
default_executable:
|
20
|
+
date: 2012-02-15 00:00:00 Z
|
22
21
|
dependencies:
|
23
22
|
- !ruby/object:Gem::Dependency
|
24
|
-
|
25
|
-
prerelease: false
|
26
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
27
24
|
none: false
|
28
25
|
requirements:
|
29
26
|
- - "="
|
@@ -35,12 +32,12 @@ dependencies:
|
|
35
32
|
- 13
|
36
33
|
- 1
|
37
34
|
version: 1.0.13.1
|
35
|
+
requirement: *id001
|
38
36
|
type: :runtime
|
39
|
-
version_requirements: *id001
|
40
|
-
- !ruby/object:Gem::Dependency
|
41
|
-
name: activesupport
|
42
37
|
prerelease: false
|
43
|
-
|
38
|
+
name: ghazel-daemons
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
44
41
|
none: false
|
45
42
|
requirements:
|
46
43
|
- - ~>
|
@@ -50,12 +47,12 @@ dependencies:
|
|
50
47
|
- 2
|
51
48
|
- 0
|
52
49
|
version: "2.0"
|
50
|
+
requirement: *id002
|
53
51
|
type: :runtime
|
54
|
-
version_requirements: *id002
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
52
|
prerelease: false
|
58
|
-
|
53
|
+
name: activesupport
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
59
56
|
none: false
|
60
57
|
requirements:
|
61
58
|
- - ~>
|
@@ -65,12 +62,12 @@ dependencies:
|
|
65
62
|
- 1
|
66
63
|
- 0
|
67
64
|
version: "1.0"
|
65
|
+
requirement: *id003
|
68
66
|
type: :development
|
69
|
-
version_requirements: *id003
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rake
|
72
67
|
prerelease: false
|
73
|
-
|
68
|
+
name: rspec
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
74
71
|
none: false
|
75
72
|
requirements:
|
76
73
|
- - ">="
|
@@ -79,12 +76,12 @@ dependencies:
|
|
79
76
|
segments:
|
80
77
|
- 0
|
81
78
|
version: "0"
|
79
|
+
requirement: *id004
|
82
80
|
type: :development
|
83
|
-
version_requirements: *id004
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rails
|
86
81
|
prerelease: false
|
87
|
-
|
82
|
+
name: rake
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
88
85
|
none: false
|
89
86
|
requirements:
|
90
87
|
- - ~>
|
@@ -94,12 +91,12 @@ dependencies:
|
|
94
91
|
- 2
|
95
92
|
- 3
|
96
93
|
version: "2.3"
|
94
|
+
requirement: *id005
|
97
95
|
type: :development
|
98
|
-
version_requirements: *id005
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: sqlite3
|
101
96
|
prerelease: false
|
102
|
-
|
97
|
+
name: rails
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
103
100
|
none: false
|
104
101
|
requirements:
|
105
102
|
- - ">="
|
@@ -108,12 +105,12 @@ dependencies:
|
|
108
105
|
segments:
|
109
106
|
- 0
|
110
107
|
version: "0"
|
108
|
+
requirement: *id006
|
111
109
|
type: :development
|
112
|
-
version_requirements: *id006
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: mysql
|
115
110
|
prerelease: false
|
116
|
-
|
111
|
+
name: sqlite3
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
117
114
|
none: false
|
118
115
|
requirements:
|
119
116
|
- - ">="
|
@@ -122,12 +119,12 @@ dependencies:
|
|
122
119
|
segments:
|
123
120
|
- 0
|
124
121
|
version: "0"
|
122
|
+
requirement: *id007
|
125
123
|
type: :development
|
126
|
-
version_requirements: *id007
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: mongo_mapper
|
129
124
|
prerelease: false
|
130
|
-
|
125
|
+
name: mysql
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
131
128
|
none: false
|
132
129
|
requirements:
|
133
130
|
- - ~>
|
@@ -138,12 +135,12 @@ dependencies:
|
|
138
135
|
- 8
|
139
136
|
- 0
|
140
137
|
version: 0.8.0
|
138
|
+
requirement: *id008
|
141
139
|
type: :development
|
142
|
-
version_requirements: *id008
|
143
|
-
- !ruby/object:Gem::Dependency
|
144
|
-
name: dm-core
|
145
140
|
prerelease: false
|
146
|
-
|
141
|
+
name: mongo_mapper
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
147
144
|
none: false
|
148
145
|
requirements:
|
149
146
|
- - ">="
|
@@ -152,12 +149,12 @@ dependencies:
|
|
152
149
|
segments:
|
153
150
|
- 0
|
154
151
|
version: "0"
|
152
|
+
requirement: *id009
|
155
153
|
type: :development
|
156
|
-
version_requirements: *id009
|
157
|
-
- !ruby/object:Gem::Dependency
|
158
|
-
name: dm-observer
|
159
154
|
prerelease: false
|
160
|
-
|
155
|
+
name: dm-core
|
156
|
+
- !ruby/object:Gem::Dependency
|
157
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
161
158
|
none: false
|
162
159
|
requirements:
|
163
160
|
- - ">="
|
@@ -166,12 +163,12 @@ dependencies:
|
|
166
163
|
segments:
|
167
164
|
- 0
|
168
165
|
version: "0"
|
166
|
+
requirement: *id010
|
169
167
|
type: :development
|
170
|
-
version_requirements: *id010
|
171
|
-
- !ruby/object:Gem::Dependency
|
172
|
-
name: dm-aggregates
|
173
168
|
prerelease: false
|
174
|
-
|
169
|
+
name: dm-observer
|
170
|
+
- !ruby/object:Gem::Dependency
|
171
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
175
172
|
none: false
|
176
173
|
requirements:
|
177
174
|
- - ">="
|
@@ -180,12 +177,12 @@ dependencies:
|
|
180
177
|
segments:
|
181
178
|
- 0
|
182
179
|
version: "0"
|
180
|
+
requirement: *id011
|
183
181
|
type: :development
|
184
|
-
version_requirements: *id011
|
185
|
-
- !ruby/object:Gem::Dependency
|
186
|
-
name: dm-validations
|
187
182
|
prerelease: false
|
188
|
-
|
183
|
+
name: dm-aggregates
|
184
|
+
- !ruby/object:Gem::Dependency
|
185
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
189
186
|
none: false
|
190
187
|
requirements:
|
191
188
|
- - ">="
|
@@ -194,12 +191,12 @@ dependencies:
|
|
194
191
|
segments:
|
195
192
|
- 0
|
196
193
|
version: "0"
|
194
|
+
requirement: *id012
|
197
195
|
type: :development
|
198
|
-
version_requirements: *id012
|
199
|
-
- !ruby/object:Gem::Dependency
|
200
|
-
name: do_sqlite3
|
201
196
|
prerelease: false
|
202
|
-
|
197
|
+
name: dm-validations
|
198
|
+
- !ruby/object:Gem::Dependency
|
199
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
203
200
|
none: false
|
204
201
|
requirements:
|
205
202
|
- - ">="
|
@@ -208,12 +205,12 @@ dependencies:
|
|
208
205
|
segments:
|
209
206
|
- 0
|
210
207
|
version: "0"
|
208
|
+
requirement: *id013
|
211
209
|
type: :development
|
212
|
-
version_requirements: *id013
|
213
|
-
- !ruby/object:Gem::Dependency
|
214
|
-
name: database_cleaner
|
215
210
|
prerelease: false
|
216
|
-
|
211
|
+
name: do_sqlite3
|
212
|
+
- !ruby/object:Gem::Dependency
|
213
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
217
214
|
none: false
|
218
215
|
requirements:
|
219
216
|
- - ">="
|
@@ -222,8 +219,10 @@ dependencies:
|
|
222
219
|
segments:
|
223
220
|
- 0
|
224
221
|
version: "0"
|
222
|
+
requirement: *id014
|
225
223
|
type: :development
|
226
|
-
|
224
|
+
prerelease: false
|
225
|
+
name: database_cleaner
|
227
226
|
description: |-
|
228
227
|
Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.
|
229
228
|
|
@@ -274,7 +273,6 @@ files:
|
|
274
273
|
- tasks/jobs.rake
|
275
274
|
- MIT-LICENSE
|
276
275
|
- README.textile
|
277
|
-
has_rdoc: true
|
278
276
|
homepage: http://github.com/ezpub/delayed_job
|
279
277
|
licenses: []
|
280
278
|
|
@@ -307,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
307
305
|
requirements: []
|
308
306
|
|
309
307
|
rubyforge_project:
|
310
|
-
rubygems_version: 1.
|
308
|
+
rubygems_version: 1.8.10
|
311
309
|
signing_key:
|
312
310
|
specification_version: 3
|
313
311
|
summary: Database-backed asynchronous priority queue system -- Extracted from Shopify
|