canvas-jobs 0.9.11 → 0.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/delayed/lifecycle.rb +1 -0
- data/lib/delayed/version.rb +1 -1
- data/lib/delayed/worker.rb +4 -2
- data/spec/delayed/worker_spec.rb +16 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed7324f6c7cf621f56a91226d77c82c66d6917ab
|
4
|
+
data.tar.gz: 90589f8a1452f79e0d1fd9a7508e810918792515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aea05a91a53f7bff8ddb7d61afefe0f1b0aaa757a287e3adf7616cd1b6433517ffb66f62940273a56188c0a0956e6b301b086ecba483be8aad20886ae95b9a2
|
7
|
+
data.tar.gz: 04e1e5ab0d1394bc0f354147a830081d5dea1602aa713a3166a9461f7a6e3e92c7324a2374b470e57aa97178184906e418f0b8e6f0ab8bb1085e86476cba5491
|
data/lib/delayed/lifecycle.rb
CHANGED
data/lib/delayed/version.rb
CHANGED
data/lib/delayed/worker.rb
CHANGED
@@ -136,7 +136,7 @@ class Worker
|
|
136
136
|
runtime = Benchmark.realtime do
|
137
137
|
if job.batch?
|
138
138
|
# each job in the batch will have perform called on it, so we don't
|
139
|
-
# need a timeout around this
|
139
|
+
# need a timeout around this
|
140
140
|
count = perform_batch(job)
|
141
141
|
else
|
142
142
|
job.invoke_job
|
@@ -147,7 +147,9 @@ class Worker
|
|
147
147
|
end
|
148
148
|
count
|
149
149
|
rescue Exception => e
|
150
|
-
|
150
|
+
self.class.lifecycle.run_callbacks(:error, self, job, e) do
|
151
|
+
handle_failed_job(job, e)
|
152
|
+
end
|
151
153
|
count
|
152
154
|
end
|
153
155
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative "../spec_helper"
|
2
|
+
|
3
|
+
module Delayed
|
4
|
+
describe Worker do
|
5
|
+
describe "#perform" do
|
6
|
+
it "fires off an error callback when a job raises an exception" do
|
7
|
+
fired = false
|
8
|
+
Worker.lifecycle.before(:error) {|worker, exception| fired = true}
|
9
|
+
worker = Worker.new
|
10
|
+
job = double(:last_error= => nil, attempts: 1, reschedule: nil)
|
11
|
+
worker.perform(job)
|
12
|
+
expect(fired).to be_truthy
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canvas-jobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Luetke
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: after_transaction_commit
|
@@ -263,6 +263,7 @@ files:
|
|
263
263
|
- lib/delayed/yaml_extensions.rb
|
264
264
|
- lib/delayed_job.rb
|
265
265
|
- spec/active_record_job_spec.rb
|
266
|
+
- spec/delayed/worker_spec.rb
|
266
267
|
- spec/gemfiles/32.gemfile
|
267
268
|
- spec/gemfiles/32.gemfile.lock
|
268
269
|
- spec/gemfiles/40.gemfile
|
@@ -304,6 +305,7 @@ specification_version: 4
|
|
304
305
|
summary: Instructure-maintained fork of delayed_job
|
305
306
|
test_files:
|
306
307
|
- spec/active_record_job_spec.rb
|
308
|
+
- spec/delayed/worker_spec.rb
|
307
309
|
- spec/gemfiles/32.gemfile
|
308
310
|
- spec/gemfiles/32.gemfile.lock
|
309
311
|
- spec/gemfiles/40.gemfile
|
@@ -320,3 +322,4 @@ test_files:
|
|
320
322
|
- spec/shared/worker.rb
|
321
323
|
- spec/shared_jobs_specs.rb
|
322
324
|
- spec/spec_helper.rb
|
325
|
+
has_rdoc:
|