good_job 3.15.11 → 3.15.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/app/models/good_job/process.rb +19 -0
- data/lib/good_job/capsule.rb +17 -10
- data/lib/good_job/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ba9a6bb5f97a64b3ff00e48501cbebf617372e0983c5f87f14bfe25898625b1
|
4
|
+
data.tar.gz: 673df26ced6db84ea48e77c736d8969216497034d0c19ba3f32016fd0b915afd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b39c600a8cb22842c8f2aee4b952695fad309fafb522f16f74ad9b21c20a9db4e9ff05ea13647024c1cbbb95438168cd620be89fb766605419de21e876a2ce8
|
7
|
+
data.tar.gz: 8469a0079df3bd25aa8f8474fa5cffe8a67ad7fa91efa70b7e2ebcba50e5132a1880c004e5e6bca2aa3dc12fe844a7cf4219c443644b86c7dde839833a12ab1f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v3.15.12](https://github.com/bensheldon/good_job/tree/v3.15.12) (2023-06-11)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.11...v3.15.12)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Do not allow GoodJob to automatically start after Rails initialization if previously shutdown [\#976](https://github.com/bensheldon/good_job/pull/976) ([bensheldon](https://github.com/bensheldon))
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Fix Rubocop linting [\#975](https://github.com/bensheldon/good_job/pull/975) ([bensheldon](https://github.com/bensheldon))
|
14
|
+
- Bump capybara from 3.38.0 to 3.39.1 [\#970](https://github.com/bensheldon/good_job/pull/970) ([dependabot[bot]](https://github.com/apps/dependabot))
|
15
|
+
- Bump thor from 1.2.1 to 1.2.2 [\#967](https://github.com/bensheldon/good_job/pull/967) ([dependabot[bot]](https://github.com/apps/dependabot))
|
16
|
+
|
3
17
|
## [v3.15.11](https://github.com/bensheldon/good_job/tree/v3.15.11) (2023-06-06)
|
4
18
|
|
5
19
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.10...v3.15.11)
|
@@ -7,6 +7,9 @@ module GoodJob # :nodoc:
|
|
7
7
|
include AssignableConnection
|
8
8
|
include Lockable
|
9
9
|
|
10
|
+
STALE_INTERVAL = 30.seconds
|
11
|
+
EXPIRED_INTERVAL = 5.minutes
|
12
|
+
|
10
13
|
self.table_name = 'good_job_processes'
|
11
14
|
|
12
15
|
cattr_reader :mutex, default: Mutex.new
|
@@ -76,5 +79,21 @@ module GoodJob # :nodoc:
|
|
76
79
|
def basename
|
77
80
|
File.basename(state["proctitle"])
|
78
81
|
end
|
82
|
+
|
83
|
+
def refresh
|
84
|
+
touch(:updated_at) # rubocop:disable Rails/SkipsModelValidations
|
85
|
+
end
|
86
|
+
|
87
|
+
def refresh_if_stale
|
88
|
+
refresh if stale?
|
89
|
+
end
|
90
|
+
|
91
|
+
def stale?
|
92
|
+
updated_at < STALE_INTERVAL.ago
|
93
|
+
end
|
94
|
+
|
95
|
+
def expired?
|
96
|
+
updated_at < EXPIRED_INTERVAL.ago
|
97
|
+
end
|
79
98
|
end
|
80
99
|
end
|
data/lib/good_job/capsule.rb
CHANGED
@@ -15,17 +15,18 @@ module GoodJob
|
|
15
15
|
self.class.instances << self
|
16
16
|
@configuration = configuration
|
17
17
|
|
18
|
-
@
|
18
|
+
@startable = true
|
19
19
|
@running = false
|
20
20
|
@mutex = Mutex.new
|
21
21
|
end
|
22
22
|
|
23
|
-
# Start
|
24
|
-
|
25
|
-
|
23
|
+
# Start the capsule once. After a shutdown, {#restart} must be used to start again.
|
24
|
+
# @return [nil, Boolean] Whether the capsule was started.
|
25
|
+
def start(force: false)
|
26
|
+
return unless startable?(force: force)
|
26
27
|
|
27
28
|
@mutex.synchronize do
|
28
|
-
return
|
29
|
+
return unless startable?(force: force)
|
29
30
|
|
30
31
|
@notifier = GoodJob::Notifier.new(enable_listening: @configuration.enable_listen_notify)
|
31
32
|
@poller = GoodJob::Poller.new(poll_interval: @configuration.poll_interval)
|
@@ -35,7 +36,7 @@ module GoodJob
|
|
35
36
|
|
36
37
|
@cron_manager = GoodJob::CronManager.new(@configuration.cron_entries, start_on_initialize: true) if @configuration.enable_cron?
|
37
38
|
|
38
|
-
@
|
39
|
+
@startable = false
|
39
40
|
@running = true
|
40
41
|
end
|
41
42
|
end
|
@@ -50,7 +51,7 @@ module GoodJob
|
|
50
51
|
def shutdown(timeout: :default)
|
51
52
|
timeout = timeout == :default ? @configuration.shutdown_timeout : timeout
|
52
53
|
GoodJob._shutdown_all([@notifier, @poller, @scheduler, @cron_manager].compact, timeout: timeout)
|
53
|
-
@
|
54
|
+
@startable = false
|
54
55
|
@running = false
|
55
56
|
end
|
56
57
|
|
@@ -61,7 +62,7 @@ module GoodJob
|
|
61
62
|
raise ArgumentError, "Capsule#restart cannot be called with a timeout of nil" if timeout.nil?
|
62
63
|
|
63
64
|
shutdown(timeout: timeout)
|
64
|
-
start
|
65
|
+
start(force: true)
|
65
66
|
end
|
66
67
|
|
67
68
|
# @return [Boolean] Whether the capsule is currently running.
|
@@ -76,10 +77,16 @@ module GoodJob
|
|
76
77
|
|
77
78
|
# Creates an execution thread(s) with the given attributes.
|
78
79
|
# @param job_state [Hash, nil] See {GoodJob::Scheduler#create_thread}.
|
79
|
-
# @return [Boolean, nil] Whether
|
80
|
+
# @return [Boolean, nil] Whether the thread was created.
|
80
81
|
def create_thread(job_state = nil)
|
81
|
-
start if
|
82
|
+
start if startable?
|
82
83
|
@scheduler&.create_thread(job_state)
|
83
84
|
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def startable?(force: false)
|
89
|
+
!@running && (@startable || force)
|
90
|
+
end
|
84
91
|
end
|
85
92
|
end
|
data/lib/good_job/version.rb
CHANGED
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.15.
|
4
|
+
version: 3.15.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Sheldon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|