good_job 3.27.0 → 3.27.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/good_job/adapter.rb +1 -1
- data/lib/good_job/engine.rb +10 -15
- data/lib/good_job/version.rb +1 -1
- data/lib/good_job.rb +5 -2
- metadata +1 -2
- data/lib/good_job/dependencies.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f6e4655250d166696f48733e756d69164f1c1b6371d925fa5333fd538c7850c
|
4
|
+
data.tar.gz: c65cd8ace06f23e8647ff6747eb754151a39a732a7ac9cb79534573016f20b87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bb8b51381b2e61dcb024d15fd555f2cc36a5dbd1abb0439b20e8db182c332f136be433108a07cc0fdfcc7a2321035f1136676833a81387783694db5a9c6ea32
|
7
|
+
data.tar.gz: 1054014eb0dea19141fde93ef3a99b6533804f9f5714a97be43bb9bf57183297371df458f7ac55c0c77fd3bf7d8504d49c980d9ed5f5b94f378f1468356d6c68
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v3.27.1](https://github.com/bensheldon/good_job/tree/v3.27.1) (2024-03-24)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.27.0...v3.27.1)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Start async adapters `after_initialize` instead of once Active Job and Active Record are loaded and Rails initialized? [\#1297](https://github.com/bensheldon/good_job/pull/1297) ([bensheldon](https://github.com/bensheldon))
|
10
|
+
|
3
11
|
## [v3.27.0](https://github.com/bensheldon/good_job/tree/v3.27.0) (2024-03-24)
|
4
12
|
|
5
13
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.26.2...v3.27.0)
|
data/lib/good_job/adapter.rb
CHANGED
@@ -30,7 +30,7 @@ module GoodJob
|
|
30
30
|
GoodJob::Configuration.validate_execution_mode(@_execution_mode_override) if @_execution_mode_override
|
31
31
|
@capsule = _capsule
|
32
32
|
|
33
|
-
start_async if GoodJob.
|
33
|
+
start_async if GoodJob._async_ready?
|
34
34
|
self.class.instances << self
|
35
35
|
end
|
36
36
|
|
data/lib/good_job/engine.rb
CHANGED
@@ -49,22 +49,17 @@ module GoodJob
|
|
49
49
|
end
|
50
50
|
|
51
51
|
initializer "good_job.start_async" do
|
52
|
-
# This hooks into the hookable places during Rails boot, which is unfortunately not Rails.application.initialized?
|
53
|
-
# If an Adapter is initialized during boot, we want to want to start async executors once the framework dependencies have loaded.
|
54
|
-
# When exactly that happens is out of our control because gems or application code may touch things earlier than expected.
|
55
|
-
# For example, as of Rails 6.1, if an ActiveRecord model is touched during boot, that triggers ActiveRecord to load,
|
56
|
-
# which touches DestroyAssociationAsyncJob, which loads ActiveJob, which may initialize a GoodJob::Adapter, all of which
|
57
|
-
# happens _before_ ActiveRecord finishes loading. GoodJob will deadlock if an async executor is started in the middle of
|
58
|
-
# ActiveRecord loading.
|
59
52
|
config.after_initialize do
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
53
|
+
GoodJob._async_ready = true
|
54
|
+
|
55
|
+
# Ensure Active Record and Active Job are fully loaded
|
56
|
+
ActiveRecord::Base # rubocop:disable Lint/Void
|
57
|
+
ActiveJob::Base.queue_adapter
|
58
|
+
|
59
|
+
GoodJob::Adapter.instances
|
60
|
+
.select(&:execute_async?)
|
61
|
+
.reject(&:async_started?)
|
62
|
+
.each(&:start_async)
|
68
63
|
end
|
69
64
|
end
|
70
65
|
end
|
data/lib/good_job/version.rb
CHANGED
data/lib/good_job.rb
CHANGED
@@ -25,7 +25,6 @@ require_relative "good_job/configuration"
|
|
25
25
|
require_relative "good_job/cron_manager"
|
26
26
|
require_relative "good_job/current_thread"
|
27
27
|
require_relative "good_job/daemon"
|
28
|
-
require_relative "good_job/dependencies"
|
29
28
|
require_relative "good_job/job_performer"
|
30
29
|
require_relative "good_job/job_performer/metrics"
|
31
30
|
require_relative "good_job/log_subscriber"
|
@@ -46,7 +45,6 @@ require_relative "good_job/thread_status"
|
|
46
45
|
#
|
47
46
|
# +GoodJob+ is the top-level namespace and exposes configuration attributes.
|
48
47
|
module GoodJob
|
49
|
-
include GoodJob::Dependencies
|
50
48
|
include GoodJob::ThreadStatus
|
51
49
|
|
52
50
|
# Default, null, blank value placeholder.
|
@@ -114,6 +112,11 @@ module GoodJob
|
|
114
112
|
# @return [GoodJob::Capsule, nil]
|
115
113
|
mattr_accessor :capsule, default: GoodJob::Capsule.new(configuration: configuration)
|
116
114
|
|
115
|
+
mattr_accessor :_async_ready, default: false
|
116
|
+
def self._async_ready?
|
117
|
+
_async_ready
|
118
|
+
end
|
119
|
+
|
117
120
|
# Called with exception when a GoodJob thread raises an exception
|
118
121
|
# @param exception [Exception] Exception that was raised
|
119
122
|
# @return [void]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: good_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.27.
|
4
|
+
version: 3.27.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Sheldon
|
@@ -404,7 +404,6 @@ files:
|
|
404
404
|
- lib/good_job/cron_manager.rb
|
405
405
|
- lib/good_job/current_thread.rb
|
406
406
|
- lib/good_job/daemon.rb
|
407
|
-
- lib/good_job/dependencies.rb
|
408
407
|
- lib/good_job/engine.rb
|
409
408
|
- lib/good_job/interrupt_error.rb
|
410
409
|
- lib/good_job/job_performer.rb
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module GoodJob # :nodoc:
|
4
|
-
# Extends GoodJob module to track Rails boot dependencies.
|
5
|
-
module Dependencies
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
included do
|
9
|
-
mattr_accessor :_framework_ready, default: false
|
10
|
-
end
|
11
|
-
|
12
|
-
class_methods do
|
13
|
-
# Whether Rails framework has sufficiently initialized to enable Async execution.
|
14
|
-
def async_ready?
|
15
|
-
Rails.application.initialized? || _framework_ready
|
16
|
-
end
|
17
|
-
|
18
|
-
def _start_async_adapters
|
19
|
-
return unless async_ready?
|
20
|
-
|
21
|
-
ActiveJob::Base.queue_adapter # Ensure Active Job is initialized
|
22
|
-
GoodJob::Adapter.instances
|
23
|
-
.select(&:execute_async?)
|
24
|
-
.reject(&:async_started?)
|
25
|
-
.each(&:start_async)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|