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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64df58c18931c32c09ae1e120ff915e0d7643f77
4
- data.tar.gz: 7048135401a9e919daa209ab0c3f2944950e1b28
3
+ metadata.gz: ed7324f6c7cf621f56a91226d77c82c66d6917ab
4
+ data.tar.gz: 90589f8a1452f79e0d1fd9a7508e810918792515
5
5
  SHA512:
6
- metadata.gz: b64cbe915819f26c25b5127447f3d68bdb5d564719d6a2b4c869eb6269861ff8f1e3fbd7d2f23e2058102e5c9872c13d1b4f50c44fb104b89010f18eafaade39
7
- data.tar.gz: e7b5c0e267fa4f5281c936f0a826a7795ea725ddf432b252ab14271ea07aa870b915d25dea5f88143474324c8bd9ab293322776120e8973390efa5779040e9b4
6
+ metadata.gz: 2aea05a91a53f7bff8ddb7d61afefe0f1b0aaa757a287e3adf7616cd1b6433517ffb66f62940273a56188c0a0956e6b301b086ecba483be8aad20886ae95b9a2
7
+ data.tar.gz: 04e1e5ab0d1394bc0f354147a830081d5dea1602aa713a3166a9461f7a6e3e92c7324a2374b470e57aa97178184906e418f0b8e6f0ab8bb1085e86476cba5491
@@ -7,6 +7,7 @@ module Delayed
7
7
  :pop => [:worker],
8
8
  :exceptional_exit => [:worker, :exception],
9
9
  :invoke_job => [:job],
10
+ :error => [:worker, :job, :exception],
10
11
  }
11
12
 
12
13
  def initialize
@@ -1,3 +1,3 @@
1
1
  module Delayed
2
- VERSION = "0.9.11"
2
+ VERSION = "0.9.12"
3
3
  end
@@ -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
- handle_failed_job(job, e)
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.11
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-01-14 00:00:00.000000000 Z
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: