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 +4 -4
- data/lib/resque/plugins/job_history/job_search.rb +13 -12
- data/lib/resque/plugins/job_history.rb +38 -2
- data/lib/resque/plugins/version.rb +1 -1
- metadata +58 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4310f92699cf53011dccc817c8e4588c4567852
|
4
|
+
data.tar.gz: 115ff043384828b68eae3e218047be7a518ee6ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 = [
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
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
|
-
[
|
37
|
-
|
38
|
-
|
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(
|
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
|
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.
|
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:
|
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
|