asynchronic 1.6.2 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asynchronic/process.rb +1 -1
- data/lib/asynchronic/version.rb +1 -1
- data/spec/jobs.rb +10 -2
- data/spec/process/life_cycle_examples.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d090602f5e7db3b74e67c5057d7aec4761c2007e
|
4
|
+
data.tar.gz: b2e6ce2ff2d236510a71d91d7d5e0042179e4a64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd1f22974965986b3ce74f2187edf7ad7911bee32562871a7591cea31a93fa22187beaa8b3e1fcf416a09560585460c51557669cc07c067eed6007d31d7959ed
|
7
|
+
data.tar.gz: 1a8db5dddd1501792e2bc00cfe57be14b0ef0c8f6e44d8c29a77c03bb0ce0f80d0cda483f87b84703f474a245e3bed611909e2496e0fc44e444cebca6b1bab82
|
data/lib/asynchronic/process.rb
CHANGED
@@ -196,7 +196,7 @@ module Asynchronic
|
|
196
196
|
job.before_finalize if [:completed, :aborted].include?(status) && job.respond_to?(:before_finalize)
|
197
197
|
self.status = status
|
198
198
|
rescue Exception => exception
|
199
|
-
self.error = Error.new exception
|
199
|
+
self.error = Error.new exception unless error
|
200
200
|
self.status = :aborted
|
201
201
|
end
|
202
202
|
end
|
data/lib/asynchronic/version.rb
CHANGED
data/spec/jobs.rb
CHANGED
@@ -385,7 +385,6 @@ class BeforeFinalizeAbortedJob < Asynchronic::Job
|
|
385
385
|
end
|
386
386
|
|
387
387
|
class BeforeFinalizeRaisesExceptionJob < Asynchronic::Job
|
388
|
-
|
389
388
|
def call
|
390
389
|
nil
|
391
390
|
end
|
@@ -393,5 +392,14 @@ class BeforeFinalizeRaisesExceptionJob < Asynchronic::Job
|
|
393
392
|
def before_finalize
|
394
393
|
raise 'Before finalize exception'
|
395
394
|
end
|
395
|
+
end
|
396
|
+
|
397
|
+
class BeforeFinalizeExceptionOnAbortedJob < Asynchronic::Job
|
398
|
+
def call
|
399
|
+
raise 'Job error'
|
400
|
+
end
|
396
401
|
|
397
|
-
|
402
|
+
def before_finalize
|
403
|
+
raise 'Before finalize error'
|
404
|
+
end
|
405
|
+
end
|
@@ -708,4 +708,23 @@ module LifeCycleExamples
|
|
708
708
|
queue.must_be_empty
|
709
709
|
end
|
710
710
|
|
711
|
+
it 'Before finalize raises exception on aborted job' do
|
712
|
+
process = create BeforeFinalizeExceptionOnAbortedJob
|
713
|
+
|
714
|
+
process.must_be_initialized
|
715
|
+
queue.must_be_empty
|
716
|
+
|
717
|
+
process.enqueue
|
718
|
+
|
719
|
+
process.must_be_queued
|
720
|
+
queue.must_enqueued process
|
721
|
+
|
722
|
+
execute queue
|
723
|
+
|
724
|
+
process.must_be_aborted
|
725
|
+
process.real_error.must_equal 'Job error'
|
726
|
+
queue.must_be_empty
|
727
|
+
end
|
728
|
+
|
729
|
+
|
711
730
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asynchronic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|