resque-job_history 0.0.11 → 0.0.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: 12b7b70a26083af7bc43e79071c56a7b1a9b1c7a
4
- data.tar.gz: f34d0ea2e6a27e9aa272051c53b1c40b01550e1a
3
+ metadata.gz: e4310f92699cf53011dccc817c8e4588c4567852
4
+ data.tar.gz: 115ff043384828b68eae3e218047be7a518ee6ae
5
5
  SHA512:
6
- metadata.gz: f8418efa6f85eafbd533c0a4592ff671d7c462c926a4071ee292cc6be468fcdd027ab6f1b2f85e790ef5dced7ee97ab54f56b94030bf414e977bcb4bb20f727d
7
- data.tar.gz: cdcc689db81b7131d7c27e09b8890d39cee88f57e6be6330fae1234bfedf4d7f66d68f85d2731ef50fffa0cd9d548fbba6c6b78b86dd1cbf6f32f40626534532
6
+ metadata.gz: 6d2c1ea17b38c8cf3084ff3eeaf0d0fdbe12c42ff2db931445f8d0db69ec7b4e5e35e11a27370cfdc68e72ba897563f6e1d2157d5d5e90650d544f39bd31d019
7
+ data.tar.gz: 7df391e8650d8775d8eb0a8c76bc32bc463aed5d3914235fafd233d8d70bafe39f0db04dc0a691d1434be8b58d512a87d784db077e394884785834b1f42762f8
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # rubocop:disable ClassLength
3
4
 
4
5
  module Resque
@@ -6,16 +7,16 @@ module Resque
6
7
  module JobHistory
7
8
  # This class searches through jobs looking for one which matches the passed in criteria.
8
9
  class JobSearch
9
- ALL_ATTRIBUTES = [:search_type,
10
- :job_class_name,
11
- :search_for,
12
- :regex_search,
13
- :case_insensitive,
14
- :last_class_name,
15
- :last_job_id,
16
- :last_job_group].freeze
10
+ ALL_ATTRIBUTES = %i[search_type
11
+ job_class_name
12
+ search_for
13
+ regex_search
14
+ case_insensitive
15
+ last_class_name
16
+ last_job_id
17
+ last_job_group].freeze
17
18
 
18
- SEARCH_TYPES = %w(search_all search_job search_linear_history).freeze
19
+ SEARCH_TYPES = %w[search_all search_job search_linear_history].freeze
19
20
 
20
21
  DEFAULT_SEARCH_TIMEOUT = 10.seconds
21
22
 
@@ -33,9 +34,9 @@ module Resque
33
34
  def retry_search_settings(all_settings)
34
35
  settings = search_settings(all_settings)
35
36
 
36
- [:last_class_name,
37
- :last_job_id,
38
- :last_job_group].each do |continue_setting|
37
+ %i[last_class_name
38
+ last_job_id
39
+ last_job_group].each do |continue_setting|
39
40
  settings.delete(continue_setting)
40
41
  end
41
42
 
@@ -39,10 +39,10 @@ module Resque
39
39
  # recorded.
40
40
  module ClassMethods
41
41
  def around_perform_job_history(*args)
42
- running_job = Resque::Plugins::JobHistory::Job.new(name, SecureRandom.uuid)
42
+ running_job = Resque::Plugins::JobHistory::Job.new(active_job_class_name(*args), SecureRandom.uuid)
43
43
 
44
44
  begin
45
- running_job.start(*args)
45
+ running_job.start(*active_job_args(*args))
46
46
 
47
47
  yield if block_given?
48
48
 
@@ -74,7 +74,43 @@ module Resque
74
74
  def job_history
75
75
  Resque::Plugins::JobHistory::HistoryDetails.new(name)
76
76
  end
77
+
78
+ private
79
+
80
+ def job_class_has_history?(*args)
81
+ if Object.const_defined?("ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper") &&
82
+ self >= ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper
83
+ args[-1]["job_class"].constantize.included_modules.include? Resque::Plugins::JobHistory
84
+ else
85
+ true
86
+ end
87
+ end
88
+
89
+ def active_job_class_name(*args)
90
+ if Object.const_defined?("ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper") &&
91
+ self >= ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper
92
+ args[-1]["job_class"]
93
+ else
94
+ name
95
+ end
96
+ end
97
+
98
+ def active_job_args(*args)
99
+ if Object.const_defined?("ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper") &&
100
+ self >= ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper
101
+ args[-1]["arguments"]
102
+ else
103
+ args
104
+ end
105
+ end
77
106
  end
78
107
  end
79
108
  end
80
109
  end
110
+
111
+ if Object.const_defined?("ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper")
112
+ unless ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper.included_modules.
113
+ include? Resque::Plugins::JobHistory
114
+ ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper.include Resque::Plugins::JobHistory
115
+ end
116
+ end
@@ -3,7 +3,7 @@
3
3
  module Resque
4
4
  module Plugins
5
5
  module JobHistory
6
- VERSION = "0.0.11"
6
+ VERSION = "0.0.12"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-job_history
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - RealNobody
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-09 00:00:00.000000000 Z
11
+ date: 2017-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resque
@@ -52,6 +52,62 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: actionpack
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activejob
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activesupport
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sinatra
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.4'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.4'
55
111
  - !ruby/object:Gem::Dependency
56
112
  name: rspec-rails
57
113
  requirement: !ruby/object:Gem::Requirement