resque-job_history 0.0.8 → 0.0.9

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: 0c3f478df1a3604bb27c14414e3ed7ffbfc34dde
4
- data.tar.gz: 9b0d78e32b57b098cd8150747372df8bbf203600
3
+ metadata.gz: a1bcddf23e0810a21b31ff619ee1c7a5c5f11974
4
+ data.tar.gz: 2dff8784d8d962f84b3ce2c9cc197ca52f6fad9d
5
5
  SHA512:
6
- metadata.gz: 1fcb4e9aa99d234359507f689cc329f311b5c98f3f2d61864f37ae40dd2aa616b79ccf20b36421839a71fd8412acdb7a204511c7cf44098f47aef44edb6f9526
7
- data.tar.gz: f610d895c93dfeeb2eeb29e71c2c96a47e414a768da3606bfd39c5f3e062f81b84a6c07ab8411523ccb2d6a689eb8a6e7aba2b1be9a211a024be6463ef68ff3f
6
+ metadata.gz: 9bd5e7b212eef1755b55b2e2d069727fd79634c5356eca014b451dbf06f525e4280aa5ddd96ee32b63c47a17db68227bb09829560c17d19861476f79198c8093
7
+ data.tar.gz: d8c0b165e02196b451a9bf5066376841670a96300aaff547cb796eb1de8b95cee1f71b083d2a8f9d2920896a569003ae3d74efadb12cb1871717339172c37b0c
@@ -38,24 +38,21 @@ module Resque
38
38
  # The class methods added to the job class that is being enqueued and whose history is to be
39
39
  # recorded.
40
40
  module ClassMethods
41
- attr_reader :running_job
41
+ def around_perform_job_history(*args)
42
+ running_job = Resque::Plugins::JobHistory::Job.new(name, SecureRandom.uuid)
42
43
 
43
- def before_perform_job_history(*args)
44
- running_job.cancel if running_job
44
+ begin
45
+ running_job.start(*args)
45
46
 
46
- @running_job = Resque::Plugins::JobHistory::Job.new(name, SecureRandom.uuid)
47
+ yield if block_given?
47
48
 
48
- running_job.start(*args)
49
- end
50
-
51
- def after_perform_job_history(*_args)
52
- running_job.try(:finish)
53
- @running_job = nil
54
- end
55
-
56
- def on_failure_job_history(exception, *_args)
57
- running_job.try(:failed, exception)
58
- @running_job = nil
49
+ running_job.finish
50
+ rescue StandardError => exception
51
+ running_job.failed exception
52
+ raise
53
+ ensure
54
+ running_job.cancel unless running_job.finished? || running_job.error
55
+ end
59
56
  end
60
57
 
61
58
  def job_history_len
@@ -3,7 +3,7 @@
3
3
  module Resque
4
4
  module Plugins
5
5
  module JobHistory
6
- VERSION = "0.0.8"
6
+ VERSION = "0.0.9"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-job_history
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - RealNobody