good_job 3.3.0 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +58 -10
- data/{lib → app/models/concerns}/good_job/filterable.rb +0 -0
- data/{lib/models → app/models/concerns}/good_job/reportable.rb +0 -0
- data/{lib → app}/models/good_job/active_job_job.rb +0 -0
- data/{lib → app}/models/good_job/base_record.rb +0 -0
- data/{lib → app}/models/good_job/cron_entry.rb +1 -1
- data/{lib → app}/models/good_job/execution.rb +0 -0
- data/{lib → app/models}/good_job/execution_result.rb +0 -0
- data/{lib → app}/models/good_job/job.rb +1 -1
- data/{lib → app}/models/good_job/lockable.rb +0 -0
- data/{lib → app}/models/good_job/process.rb +4 -0
- data/app/views/good_job/processes/index.html.erb +3 -3
- data/app/views/good_job/shared/_navbar.erb +1 -1
- data/lib/good_job/adapter.rb +27 -16
- data/lib/good_job/cli.rb +4 -4
- data/lib/good_job/configuration.rb +6 -1
- data/lib/good_job/enqueuing.rb +4 -0
- data/lib/good_job/notifier.rb +1 -0
- data/lib/good_job/version.rb +1 -1
- data/lib/good_job.rb +29 -14
- metadata +17 -31
- data/lib/good_job/active_job_extensions.rb +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f8fa4783c84a1fa080726fad9771b6414c7ece765a54bd8641e9629c658c426
|
|
4
|
+
data.tar.gz: 9de3f045df0fafdb537c454f5c7b713646e73e0e446e7b1ebe4f13ed8d3aba1c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 434f580b2874f78161406758b29b65f46bd30b61f1b876f3aa6450da6f3f3fd35843b98a226cd57ea4d531724f5cb5814e8c1fe34a642f4a68e877f85c2c9601
|
|
7
|
+
data.tar.gz: a06a69d3e03e3a4a4aacd34b8b0132488c91efe595c4559089392f0db3c6ea129483c2b3ca902aa95743f7f0b981a1821d63c557eb5d06ac7a07de7e38be6885
|
data/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,60 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v3.3.3](https://github.com/bensheldon/good_job/tree/v3.3.3) (2022-08-02)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.3.2...v3.3.3)
|
|
6
|
+
|
|
7
|
+
**Closed issues:**
|
|
8
|
+
|
|
9
|
+
- Async not working Rails 7 with puma CLI [\#685](https://github.com/bensheldon/good_job/issues/685)
|
|
10
|
+
|
|
11
|
+
**Merged pull requests:**
|
|
12
|
+
|
|
13
|
+
- Detect usage of `puma` CLI for async mode [\#686](https://github.com/bensheldon/good_job/pull/686) ([bensheldon](https://github.com/bensheldon))
|
|
14
|
+
|
|
15
|
+
## [v3.3.2](https://github.com/bensheldon/good_job/tree/v3.3.2) (2022-07-27)
|
|
16
|
+
|
|
17
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.3.1...v3.3.2)
|
|
18
|
+
|
|
19
|
+
**Fixed bugs:**
|
|
20
|
+
|
|
21
|
+
- Defer setting Adapter's execution mode until Rails initializes [\#683](https://github.com/bensheldon/good_job/pull/683) ([bensheldon](https://github.com/bensheldon))
|
|
22
|
+
|
|
23
|
+
## [v3.3.1](https://github.com/bensheldon/good_job/tree/v3.3.1) (2022-07-26)
|
|
24
|
+
|
|
25
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.3.0...v3.3.1)
|
|
26
|
+
|
|
27
|
+
**Implemented enhancements:**
|
|
28
|
+
|
|
29
|
+
- Show basename of proctitle [\#679](https://github.com/bensheldon/good_job/pull/679) ([bkeepers](https://github.com/bkeepers))
|
|
30
|
+
|
|
31
|
+
**Fixed bugs:**
|
|
32
|
+
|
|
33
|
+
- Only count \_active\_ processes in the Navbar [\#680](https://github.com/bensheldon/good_job/pull/680) ([bensheldon](https://github.com/bensheldon))
|
|
34
|
+
- Remove Zeitwerk and use explicit requires to be more like an engine [\#677](https://github.com/bensheldon/good_job/pull/677) ([bensheldon](https://github.com/bensheldon))
|
|
35
|
+
|
|
36
|
+
**Closed issues:**
|
|
37
|
+
|
|
38
|
+
- Dashboard UI Invalid count of running process [\#678](https://github.com/bensheldon/good_job/issues/678)
|
|
39
|
+
|
|
40
|
+
**Merged pull requests:**
|
|
41
|
+
|
|
42
|
+
- Lock to dotenv 2.7.x for Ruby 2.5 compatibility [\#682](https://github.com/bensheldon/good_job/pull/682) ([bensheldon](https://github.com/bensheldon))
|
|
43
|
+
- Create global GoodJob.configuration object [\#681](https://github.com/bensheldon/good_job/pull/681) ([bensheldon](https://github.com/bensheldon))
|
|
44
|
+
|
|
3
45
|
## [v3.3.0](https://github.com/bensheldon/good_job/tree/v3.3.0) (2022-07-24)
|
|
4
46
|
|
|
5
47
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.2.0...v3.3.0)
|
|
6
48
|
|
|
49
|
+
**Implemented enhancements:**
|
|
50
|
+
|
|
51
|
+
- Dashboard: Update cron and processes to match jobs listing [\#676](https://github.com/bensheldon/good_job/pull/676) ([bkeepers](https://github.com/bkeepers))
|
|
52
|
+
- Dashboard: improvements to jobs index and show pages [\#672](https://github.com/bensheldon/good_job/pull/672) ([bkeepers](https://github.com/bkeepers))
|
|
53
|
+
|
|
54
|
+
**Fixed bugs:**
|
|
55
|
+
|
|
56
|
+
- Replace "timestamp" column-type in migrations with "datetime" [\#671](https://github.com/bensheldon/good_job/pull/671) ([bensheldon](https://github.com/bensheldon))
|
|
57
|
+
|
|
7
58
|
**Closed issues:**
|
|
8
59
|
|
|
9
60
|
- Calculating database connections [\#669](https://github.com/bensheldon/good_job/issues/669)
|
|
@@ -14,9 +65,6 @@
|
|
|
14
65
|
|
|
15
66
|
**Merged pull requests:**
|
|
16
67
|
|
|
17
|
-
- Dashboard: Update cron and processes to match jobs listing [\#676](https://github.com/bensheldon/good_job/pull/676) ([bkeepers](https://github.com/bkeepers))
|
|
18
|
-
- Dashboard: improvements to jobs index and show pages [\#672](https://github.com/bensheldon/good_job/pull/672) ([bkeepers](https://github.com/bkeepers))
|
|
19
|
-
- Replace "timestamp" column-type in migrations with "datetime" [\#671](https://github.com/bensheldon/good_job/pull/671) ([bensheldon](https://github.com/bensheldon))
|
|
20
68
|
- Improve Readme description of v3 job preservation defaults [\#670](https://github.com/bensheldon/good_job/pull/670) ([bensheldon](https://github.com/bensheldon))
|
|
21
69
|
- update Gemfile.lock to latest dependencies [\#647](https://github.com/bensheldon/good_job/pull/647) ([jrochkind](https://github.com/jrochkind))
|
|
22
70
|
|
|
@@ -24,7 +72,7 @@
|
|
|
24
72
|
|
|
25
73
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.1.0...v3.2.0)
|
|
26
74
|
|
|
27
|
-
**
|
|
75
|
+
**Implemented enhancements:**
|
|
28
76
|
|
|
29
77
|
- Ordered queue handling by workers [\#665](https://github.com/bensheldon/good_job/pull/665) ([jrochkind](https://github.com/jrochkind))
|
|
30
78
|
|
|
@@ -34,7 +82,9 @@
|
|
|
34
82
|
|
|
35
83
|
**Implemented enhancements:**
|
|
36
84
|
|
|
85
|
+
- Show job/cron/process counts in the Navbar [\#663](https://github.com/bensheldon/good_job/pull/663) ([bensheldon](https://github.com/bensheldon))
|
|
37
86
|
- Improve Dashboard display of parameters \(CronEntry kwargs; Process configuration; Job and Execution database values\) [\#662](https://github.com/bensheldon/good_job/pull/662) ([bensheldon](https://github.com/bensheldon))
|
|
87
|
+
- Dequeing should be first-in first-out [\#651](https://github.com/bensheldon/good_job/pull/651) ([jrochkind](https://github.com/jrochkind))
|
|
38
88
|
|
|
39
89
|
**Fixed bugs:**
|
|
40
90
|
|
|
@@ -47,11 +97,6 @@
|
|
|
47
97
|
- Cron schedule page in dashboard not showing kwargs [\#608](https://github.com/bensheldon/good_job/issues/608)
|
|
48
98
|
- Paralelism x database connections [\#569](https://github.com/bensheldon/good_job/issues/569)
|
|
49
99
|
|
|
50
|
-
**Merged pull requests:**
|
|
51
|
-
|
|
52
|
-
- Show job/cron/process counts in the Navbar [\#663](https://github.com/bensheldon/good_job/pull/663) ([bensheldon](https://github.com/bensheldon))
|
|
53
|
-
- Dequeing should be first-in first-out [\#651](https://github.com/bensheldon/good_job/pull/651) ([jrochkind](https://github.com/jrochkind))
|
|
54
|
-
|
|
55
100
|
## [v3.0.2](https://github.com/bensheldon/good_job/tree/v3.0.2) (2022-07-10)
|
|
56
101
|
|
|
57
102
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.0.1...v3.0.2)
|
|
@@ -81,13 +126,16 @@
|
|
|
81
126
|
|
|
82
127
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.0.0...v3.0.1)
|
|
83
128
|
|
|
129
|
+
**Fixed bugs:**
|
|
130
|
+
|
|
131
|
+
- Fix `GoodJob.cleanup_preserved_jobs` to use `delete_all` instead of `destroy_all` [\#652](https://github.com/bensheldon/good_job/pull/652) ([bensheldon](https://github.com/bensheldon))
|
|
132
|
+
|
|
84
133
|
**Closed issues:**
|
|
85
134
|
|
|
86
135
|
- ERROR: relation "good\_jobs" does not exist at character 454 [\#308](https://github.com/bensheldon/good_job/issues/308)
|
|
87
136
|
|
|
88
137
|
**Merged pull requests:**
|
|
89
138
|
|
|
90
|
-
- Fix `GoodJob.cleanup_preserved_jobs` to use `delete_all` instead of `destroy_all` [\#652](https://github.com/bensheldon/good_job/pull/652) ([bensheldon](https://github.com/bensheldon))
|
|
91
139
|
- Create codeql-analysis.yml [\#648](https://github.com/bensheldon/good_job/pull/648) ([bensheldon](https://github.com/bensheldon))
|
|
92
140
|
|
|
93
141
|
## [v3.0.0](https://github.com/bensheldon/good_job/tree/v3.0.0) (2022-06-26)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -28,7 +28,7 @@ module GoodJob
|
|
|
28
28
|
self.primary_key = 'active_job_id'
|
|
29
29
|
self.advisory_lockable_column = 'active_job_id'
|
|
30
30
|
|
|
31
|
-
has_many :executions, -> { order(created_at: :asc) }, class_name: 'GoodJob::Execution', foreign_key: 'active_job_id', inverse_of: :job
|
|
31
|
+
has_many :executions, -> { order(created_at: :asc) }, class_name: 'GoodJob::Execution', foreign_key: 'active_job_id', inverse_of: :job # rubocop:disable Rails/HasManyOrHasOneDependent
|
|
32
32
|
|
|
33
33
|
# Only the most-recent unretried execution represents a "Job"
|
|
34
34
|
default_scope { where(retried_good_job_id: nil) }
|
|
File without changes
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
<div id="<%= dom_id(process) %>" class="<%= dom_class(process) %> list-group-item py-3" role="row">
|
|
26
26
|
<div class="row align-items-center">
|
|
27
27
|
<div class="col">
|
|
28
|
-
|
|
28
|
+
<%= tag.code title: process.state['proctitle'], class: "font-monospace" do %>
|
|
29
29
|
<span class="text-muted opacity-50">$</span>
|
|
30
|
-
<%= process.
|
|
31
|
-
|
|
30
|
+
<%= process.basename %>
|
|
31
|
+
<% end %>
|
|
32
32
|
<div>
|
|
33
33
|
<span class="text-muted small">PID</span>
|
|
34
34
|
<span class="badge rounded-pill bg-light text-dark"><%= process.state["pid"] %></span>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<li class="nav-item">
|
|
25
25
|
<%= link_to processes_path, class: ["nav-link", ("active" if controller_name == 'processes')] do %>
|
|
26
26
|
<%= t(".processes") %>
|
|
27
|
-
<% processes_count = GoodJob::Process.count %>
|
|
27
|
+
<% processes_count = GoodJob::Process.active.count %>
|
|
28
28
|
<span class="badge bg-secondary rounded-pill <%= "bg-danger" if processes_count == 0 %>"><%= processes_count %></span>
|
|
29
29
|
<% end %>
|
|
30
30
|
</li>
|
data/lib/good_job/adapter.rb
CHANGED
|
@@ -25,10 +25,10 @@ module GoodJob
|
|
|
25
25
|
# - +production+ and all other environments: +:external+
|
|
26
26
|
#
|
|
27
27
|
def initialize(execution_mode: nil)
|
|
28
|
-
@
|
|
29
|
-
@
|
|
30
|
-
self.class.instances << self
|
|
28
|
+
@_execution_mode_override = execution_mode
|
|
29
|
+
GoodJob::Configuration.validate_execution_mode(@_execution_mode_override) if @_execution_mode_override
|
|
31
30
|
|
|
31
|
+
self.class.instances << self
|
|
32
32
|
start_async if GoodJob.async_ready?
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -82,7 +82,7 @@ module GoodJob
|
|
|
82
82
|
# @return [void]
|
|
83
83
|
def shutdown(timeout: :default)
|
|
84
84
|
timeout = if timeout == :default
|
|
85
|
-
|
|
85
|
+
GoodJob.configuration.shutdown_timeout
|
|
86
86
|
else
|
|
87
87
|
timeout
|
|
88
88
|
end
|
|
@@ -92,24 +92,31 @@ module GoodJob
|
|
|
92
92
|
@_async_started = false
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
+
# This adapter's execution mode
|
|
96
|
+
# @return [Symbol, nil]
|
|
97
|
+
def execution_mode
|
|
98
|
+
@_execution_mode_override || GoodJob.configuration.execution_mode
|
|
99
|
+
end
|
|
100
|
+
|
|
95
101
|
# Whether in +:async+ execution mode.
|
|
96
102
|
# @return [Boolean]
|
|
97
103
|
def execute_async?
|
|
98
|
-
|
|
99
|
-
(
|
|
104
|
+
execution_mode == :async_all ||
|
|
105
|
+
(execution_mode.in?([:async, :async_server]) && in_server_process?)
|
|
100
106
|
end
|
|
101
107
|
|
|
102
108
|
# Whether in +:external+ execution mode.
|
|
103
109
|
# @return [Boolean]
|
|
104
110
|
def execute_externally?
|
|
105
|
-
|
|
106
|
-
|
|
111
|
+
execution_mode.nil? ||
|
|
112
|
+
execution_mode == :external ||
|
|
113
|
+
(execution_mode.in?([:async, :async_server]) && !in_server_process?)
|
|
107
114
|
end
|
|
108
115
|
|
|
109
116
|
# Whether in +:inline+ execution mode.
|
|
110
117
|
# @return [Boolean]
|
|
111
118
|
def execute_inline?
|
|
112
|
-
|
|
119
|
+
execution_mode == :inline
|
|
113
120
|
end
|
|
114
121
|
|
|
115
122
|
# Start async executors
|
|
@@ -118,12 +125,12 @@ module GoodJob
|
|
|
118
125
|
return unless execute_async?
|
|
119
126
|
|
|
120
127
|
@notifier = GoodJob::Notifier.new
|
|
121
|
-
@poller = GoodJob::Poller.new(poll_interval:
|
|
122
|
-
@scheduler = GoodJob::Scheduler.from_configuration(
|
|
128
|
+
@poller = GoodJob::Poller.new(poll_interval: GoodJob.configuration.poll_interval)
|
|
129
|
+
@scheduler = GoodJob::Scheduler.from_configuration(GoodJob.configuration, warm_cache_on_initialize: true)
|
|
123
130
|
@notifier.recipients << [@scheduler, :create_thread]
|
|
124
131
|
@poller.recipients << [@scheduler, :create_thread]
|
|
125
132
|
|
|
126
|
-
@cron_manager = GoodJob::CronManager.new(
|
|
133
|
+
@cron_manager = GoodJob::CronManager.new(GoodJob.configuration.cron_entries, start_on_initialize: true) if GoodJob.configuration.enable_cron?
|
|
127
134
|
|
|
128
135
|
@_async_started = true
|
|
129
136
|
end
|
|
@@ -141,10 +148,14 @@ module GoodJob
|
|
|
141
148
|
def in_server_process?
|
|
142
149
|
return @_in_server_process if defined? @_in_server_process
|
|
143
150
|
|
|
144
|
-
@_in_server_process = Rails.const_defined?(:Server) ||
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
151
|
+
@_in_server_process = Rails.const_defined?(:Server) || begin
|
|
152
|
+
self_caller = caller
|
|
153
|
+
|
|
154
|
+
self_caller.grep(%r{config.ru}).any? || # EXAMPLE: config.ru:3:in `block in <main>' OR config.ru:3:in `new_from_string'
|
|
155
|
+
self_caller.grep(%r{puma/request}).any? || # EXAMPLE: puma-5.6.4/lib/puma/request.rb:76:in `handle_request'
|
|
156
|
+
self_caller.grep(%{/rack/handler/}).any? || # EXAMPLE: iodine-0.7.44/lib/rack/handler/iodine.rb:13:in `start'
|
|
157
|
+
(Concurrent.on_jruby? && self_caller.grep(%r{jruby/rack/rails_booter}).any?) # EXAMPLE: uri:classloader:/jruby/rack/rails_booter.rb:83:in `load_environment'
|
|
158
|
+
end
|
|
148
159
|
end
|
|
149
160
|
end
|
|
150
161
|
end
|
data/lib/good_job/cli.rb
CHANGED
|
@@ -85,7 +85,8 @@ module GoodJob
|
|
|
85
85
|
|
|
86
86
|
def start
|
|
87
87
|
set_up_application!
|
|
88
|
-
|
|
88
|
+
GoodJob.configuration.options.merge!(options.symbolize_keys)
|
|
89
|
+
configuration = GoodJob.configuration
|
|
89
90
|
|
|
90
91
|
Daemon.new(pidfile: configuration.pidfile).daemonize if configuration.daemonize?
|
|
91
92
|
|
|
@@ -142,10 +143,9 @@ module GoodJob
|
|
|
142
143
|
|
|
143
144
|
def cleanup_preserved_jobs
|
|
144
145
|
set_up_application!
|
|
146
|
+
GoodJob.configuration.options.merge!(options.symbolize_keys)
|
|
145
147
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
GoodJob.cleanup_preserved_jobs(older_than: configuration.cleanup_preserved_jobs_before_seconds_ago)
|
|
148
|
+
GoodJob.cleanup_preserved_jobs(older_than: GoodJob.configuration.cleanup_preserved_jobs_before_seconds_ago)
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
no_commands do
|
|
@@ -27,7 +27,12 @@ module GoodJob
|
|
|
27
27
|
# Default to not running cron
|
|
28
28
|
DEFAULT_ENABLE_CRON = false
|
|
29
29
|
|
|
30
|
+
def self.validate_execution_mode(execution_mode)
|
|
31
|
+
raise ArgumentError, "GoodJob execution mode must be one of #{EXECUTION_MODES.join(', ')}. It was '#{execution_mode}' which is not valid." unless execution_mode.in?(EXECUTION_MODES)
|
|
32
|
+
end
|
|
33
|
+
|
|
30
34
|
# The options that were explicitly set when initializing +Configuration+.
|
|
35
|
+
# It is safe to modify this hash in place; be sure to symbolize keys.
|
|
31
36
|
# @return [Hash]
|
|
32
37
|
attr_reader :options
|
|
33
38
|
|
|
@@ -47,7 +52,7 @@ module GoodJob
|
|
|
47
52
|
end
|
|
48
53
|
|
|
49
54
|
def validate!
|
|
50
|
-
|
|
55
|
+
self.class.validate_execution_mode(execution_mode)
|
|
51
56
|
end
|
|
52
57
|
|
|
53
58
|
# Specifies how and where jobs should be executed. See {Adapter#initialize}
|
data/lib/good_job/notifier.rb
CHANGED
data/lib/good_job/version.rb
CHANGED
data/lib/good_job.rb
CHANGED
|
@@ -2,19 +2,29 @@
|
|
|
2
2
|
require "active_job"
|
|
3
3
|
require "active_job/queue_adapters"
|
|
4
4
|
|
|
5
|
-
require "
|
|
6
|
-
zeitwerk_options = Gem::Version.new(Zeitwerk::VERSION) >= Gem::Version.new("2.6.0") ? { warn_on_extra_files: false } : {}
|
|
7
|
-
Zeitwerk::Loader.for_gem(**zeitwerk_options).tap do |loader|
|
|
8
|
-
loader.inflector.inflect({
|
|
9
|
-
"cli" => "CLI",
|
|
10
|
-
})
|
|
11
|
-
loader.push_dir("#{__dir__}/models")
|
|
12
|
-
loader.ignore("#{__dir__}/generators")
|
|
13
|
-
loader.setup
|
|
14
|
-
end
|
|
15
|
-
|
|
5
|
+
require "good_job/version"
|
|
16
6
|
require "good_job/engine"
|
|
17
7
|
|
|
8
|
+
require "good_job/adapter"
|
|
9
|
+
require "active_job/queue_adapters/good_job_adapter"
|
|
10
|
+
require "good_job/active_job_extensions/concurrency"
|
|
11
|
+
|
|
12
|
+
require "good_job/assignable_connection"
|
|
13
|
+
require "good_job/cleanup_tracker"
|
|
14
|
+
require "good_job/cli"
|
|
15
|
+
require "good_job/configuration"
|
|
16
|
+
require "good_job/cron_manager"
|
|
17
|
+
require 'good_job/current_thread'
|
|
18
|
+
require "good_job/daemon"
|
|
19
|
+
require "good_job/dependencies"
|
|
20
|
+
require "good_job/job_performer"
|
|
21
|
+
require "good_job/log_subscriber"
|
|
22
|
+
require "good_job/multi_scheduler"
|
|
23
|
+
require "good_job/notifier"
|
|
24
|
+
require "good_job/poller"
|
|
25
|
+
require "good_job/probe_server"
|
|
26
|
+
require "good_job/scheduler"
|
|
27
|
+
|
|
18
28
|
# GoodJob is a multithreaded, Postgres-based, ActiveJob backend for Ruby on Rails.
|
|
19
29
|
#
|
|
20
30
|
# +GoodJob+ is the top-level namespace and exposes configuration attributes.
|
|
@@ -69,6 +79,12 @@ module GoodJob
|
|
|
69
79
|
# @return [Proc, nil]
|
|
70
80
|
mattr_accessor :on_thread_error, default: nil
|
|
71
81
|
|
|
82
|
+
# @!attribute [rw] configuration
|
|
83
|
+
# @!scope class
|
|
84
|
+
# Global configuration object for GoodJob.
|
|
85
|
+
# @return [GoodJob::Configuration, nil]
|
|
86
|
+
mattr_accessor :configuration, default: GoodJob::Configuration.new({})
|
|
87
|
+
|
|
72
88
|
# Called with exception when a GoodJob thread raises an exception
|
|
73
89
|
# @param exception [Exception] Exception that was raised
|
|
74
90
|
# @return [void]
|
|
@@ -135,10 +151,9 @@ module GoodJob
|
|
|
135
151
|
# @params older_than [nil,Numeric,ActiveSupport::Duration] Jobs older than this will be destroyed (default: +86400+).
|
|
136
152
|
# @return [Integer] Number of jobs that were destroyed.
|
|
137
153
|
def self.cleanup_preserved_jobs(older_than: nil)
|
|
138
|
-
|
|
139
|
-
older_than ||= configuration.cleanup_preserved_jobs_before_seconds_ago
|
|
154
|
+
older_than ||= GoodJob.configuration.cleanup_preserved_jobs_before_seconds_ago
|
|
140
155
|
timestamp = Time.current - older_than
|
|
141
|
-
include_discarded = configuration.cleanup_discarded_jobs?
|
|
156
|
+
include_discarded = GoodJob.configuration.cleanup_discarded_jobs?
|
|
142
157
|
|
|
143
158
|
ActiveSupport::Notifications.instrument("cleanup_preserved_jobs.good_job", { older_than: older_than, timestamp: timestamp }) do |payload|
|
|
144
159
|
old_jobs = GoodJob::Job.where('finished_at <= ?', timestamp)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: good_job
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.3.
|
|
4
|
+
version: 3.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ben Sheldon
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-08-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activejob
|
|
@@ -108,20 +108,6 @@ dependencies:
|
|
|
108
108
|
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '1.3'
|
|
111
|
-
- !ruby/object:Gem::Dependency
|
|
112
|
-
name: zeitwerk
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - ">="
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '2.0'
|
|
118
|
-
type: :runtime
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - ">="
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '2.0'
|
|
125
111
|
- !ruby/object:Gem::Dependency
|
|
126
112
|
name: benchmark-ips
|
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -168,16 +154,16 @@ dependencies:
|
|
|
168
154
|
name: dotenv
|
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
|
170
156
|
requirements:
|
|
171
|
-
- - "
|
|
157
|
+
- - "~>"
|
|
172
158
|
- !ruby/object:Gem::Version
|
|
173
|
-
version:
|
|
159
|
+
version: 2.7.6
|
|
174
160
|
type: :development
|
|
175
161
|
prerelease: false
|
|
176
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
177
163
|
requirements:
|
|
178
|
-
- - "
|
|
164
|
+
- - "~>"
|
|
179
165
|
- !ruby/object:Gem::Version
|
|
180
|
-
version:
|
|
166
|
+
version: 2.7.6
|
|
181
167
|
- !ruby/object:Gem::Dependency
|
|
182
168
|
name: foreman
|
|
183
169
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -383,6 +369,16 @@ files:
|
|
|
383
369
|
- app/filters/good_job/base_filter.rb
|
|
384
370
|
- app/filters/good_job/jobs_filter.rb
|
|
385
371
|
- app/helpers/good_job/application_helper.rb
|
|
372
|
+
- app/models/concerns/good_job/filterable.rb
|
|
373
|
+
- app/models/concerns/good_job/reportable.rb
|
|
374
|
+
- app/models/good_job/active_job_job.rb
|
|
375
|
+
- app/models/good_job/base_record.rb
|
|
376
|
+
- app/models/good_job/cron_entry.rb
|
|
377
|
+
- app/models/good_job/execution.rb
|
|
378
|
+
- app/models/good_job/execution_result.rb
|
|
379
|
+
- app/models/good_job/job.rb
|
|
380
|
+
- app/models/good_job/lockable.rb
|
|
381
|
+
- app/models/good_job/process.rb
|
|
386
382
|
- app/views/good_job/cron_entries/index.html.erb
|
|
387
383
|
- app/views/good_job/cron_entries/show.html.erb
|
|
388
384
|
- app/views/good_job/jobs/_executions.erb
|
|
@@ -419,7 +415,6 @@ files:
|
|
|
419
415
|
- lib/generators/good_job/templates/update/migrations/01_create_good_jobs.rb.erb
|
|
420
416
|
- lib/generators/good_job/update_generator.rb
|
|
421
417
|
- lib/good_job.rb
|
|
422
|
-
- lib/good_job/active_job_extensions.rb
|
|
423
418
|
- lib/good_job/active_job_extensions/concurrency.rb
|
|
424
419
|
- lib/good_job/adapter.rb
|
|
425
420
|
- lib/good_job/assignable_connection.rb
|
|
@@ -431,8 +426,7 @@ files:
|
|
|
431
426
|
- lib/good_job/daemon.rb
|
|
432
427
|
- lib/good_job/dependencies.rb
|
|
433
428
|
- lib/good_job/engine.rb
|
|
434
|
-
- lib/good_job/
|
|
435
|
-
- lib/good_job/filterable.rb
|
|
429
|
+
- lib/good_job/enqueuing.rb
|
|
436
430
|
- lib/good_job/job_performer.rb
|
|
437
431
|
- lib/good_job/log_subscriber.rb
|
|
438
432
|
- lib/good_job/multi_scheduler.rb
|
|
@@ -442,14 +436,6 @@ files:
|
|
|
442
436
|
- lib/good_job/probe_server.rb
|
|
443
437
|
- lib/good_job/scheduler.rb
|
|
444
438
|
- lib/good_job/version.rb
|
|
445
|
-
- lib/models/good_job/active_job_job.rb
|
|
446
|
-
- lib/models/good_job/base_record.rb
|
|
447
|
-
- lib/models/good_job/cron_entry.rb
|
|
448
|
-
- lib/models/good_job/execution.rb
|
|
449
|
-
- lib/models/good_job/job.rb
|
|
450
|
-
- lib/models/good_job/lockable.rb
|
|
451
|
-
- lib/models/good_job/process.rb
|
|
452
|
-
- lib/models/good_job/reportable.rb
|
|
453
439
|
homepage: https://github.com/bensheldon/good_job
|
|
454
440
|
licenses:
|
|
455
441
|
- MIT
|