rocketjob 6.0.1 → 6.0.2

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
  SHA256:
3
- metadata.gz: 305189df5d57cf64c3d771bc05f940df6be6fd8c322ae9f3f796166fe99e1b75
4
- data.tar.gz: a16ed0d77f1d1cb4e0ec4beefba922278a8b05e90ab5ecaffe6a3c347abdfed0
3
+ metadata.gz: 10ef66caa28110774987fdeff06af1a4906ed724bc307bf55d012e1104a9eca8
4
+ data.tar.gz: b0384cccd5d694a3431c6c9cb7d004603c4b79865929b8c2bb249b4b66e937a2
5
5
  SHA512:
6
- metadata.gz: f2afe61652e3b6b225515b95e7b370f8c4a8853c30cad45d0fc93d49a86571764b480aaca5a5cfb264ea1ea86912b6b680e4e122952383f2425585e3683e8581
7
- data.tar.gz: eb1b041fbe425143c5f2b64aa5e799c35bf6885c00020964cf87d87485ba359e19796f7e5c5378baefe9f4ca93fe5de900b78e6669c7ffe83838c87e197ab0e1
6
+ metadata.gz: 331a1c21ad9c2b481e67d5d3857e3158dd23a7bb6524dd872773e0aad0e0c5edb4e02d4a60be6498bc212e2517c81c027ce7f22d6b378e9d5772c391669c4347
7
+ data.tar.gz: e46cdffa443cc75d5dbed5f396ec84fb19fd12bad5b48bbddad7d310526a941bd837f778da8391460e40c575caed62c6e0329adc99ae8c58b07ada694cb1684c
@@ -75,27 +75,26 @@ module RocketJob
75
75
  return category_name if category_name.is_a?(Category::Input)
76
76
  raise(ArgumentError, "Cannot supply Output Category to input category") if category_name.is_a?(Category::Output)
77
77
 
78
+ # Initialize categories when this method is called before initialization is complete
79
+ rocketjob_categories_assign if input_categories.empty?
80
+
78
81
  category_name = category_name.to_sym
79
82
  # find does not work against this association
80
83
  input_categories.each { |category| return category if category.name == category_name }
81
84
 
82
- unless category_name == :main
83
- raise(
84
- ArgumentError,
85
- "Unknown Input Category: #{category_name.inspect}. Registered categories: #{input_categories.collect(&:name).join(',')}"
86
- )
87
- end
88
-
89
- # Auto-register main input category when not defined
90
- category = Category::Input.new(job: self)
91
- self.input_categories << category
92
- category
85
+ raise(
86
+ ArgumentError,
87
+ "Unknown Input Category: #{category_name.inspect}. Registered categories: #{input_categories.collect(&:name).join(',')}"
88
+ )
93
89
  end
94
90
 
95
91
  def output_category(category_name = :main)
96
92
  return category_name if category_name.is_a?(Category::Output)
97
93
  raise(ArgumentError, "Cannot supply Input Category to output category") if category_name.is_a?(Category::Input)
98
94
 
95
+ # Initialize categories when this method is called before initialization is complete
96
+ rocketjob_categories_assign if output_categories.empty? && self.class.defined_output_categories
97
+
99
98
  category_name = category_name.to_sym
100
99
  # .find does not work against this association
101
100
  output_categories.each { |category| return category if category.name == category_name }
@@ -154,7 +153,7 @@ module RocketJob
154
153
  end
155
154
  end
156
155
 
157
- return if !self.class.defined_output_categories || !output_categories.empty?
156
+ return if !output_categories.empty? || !self.class.defined_output_categories
158
157
 
159
158
  # Input categories defaults to nil if none was set in the class
160
159
  self.output_categories = self.class.defined_output_categories.deep_dup
@@ -164,7 +163,6 @@ module RocketJob
164
163
  def rocketjob_categories_output_render
165
164
  return if @rocket_job_output.nil?
166
165
 
167
- # TODO: ..
168
166
  return unless output_categories
169
167
  return if output_categories.empty?
170
168
 
@@ -0,0 +1,17 @@
1
+ module RocketJob
2
+ module Subscribers
3
+ # Cause all instances to refresh their in-memory copy
4
+ # of the Secret Config Registry
5
+ #
6
+ # RocketJob::Subscribers::SecretConfig.publish(:refresh)
7
+ class SecretConfig
8
+ include RocketJob::Subscriber
9
+
10
+ def refresh
11
+ logger.measure_info "Refreshed Secret Config" do
12
+ ::SecretConfig.refresh!
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -14,6 +14,7 @@ module RocketJob
14
14
  Thread.current.name = "rocketjob main"
15
15
  RocketJob.create_indexes
16
16
  register_signal_handlers
17
+ subscribe_to_events
17
18
 
18
19
  server = Server.create!
19
20
  new(server).run
@@ -34,14 +35,8 @@ module RocketJob
34
35
  logger.info "Rocket Job Server started"
35
36
 
36
37
  event_listener = Thread.new { Event.listener }
37
- Subscribers::Server.subscribe(self) do
38
- Subscribers::Worker.subscribe(self) do
39
- Subscribers::Logger.subscribe do
40
- supervise_pool
41
- stop!
42
- end
43
- end
44
- end
38
+ supervise_pool
39
+ stop!
45
40
  rescue ::Mongoid::Errors::DocumentNotFound
46
41
  logger.info("Server has been destroyed. Going down hard!")
47
42
  rescue Exception => e
@@ -94,5 +89,12 @@ module RocketJob
94
89
  def synchronize(&block)
95
90
  @mutex.synchronize(&block)
96
91
  end
92
+
93
+ def subscribe_to_events
94
+ Subscribers::Logger.subscribe
95
+ Subscribers::SecretConfig.subscribe if defined?(SecretConfig)
96
+ Subscribers::Server.subscribe
97
+ Subscribers::Worker.subscribe
98
+ end
97
99
  end
98
100
  end
@@ -1,3 +1,3 @@
1
1
  module RocketJob
2
- VERSION = "6.0.1".freeze
2
+ VERSION = "6.0.2".freeze
3
3
  end
data/lib/rocketjob.rb CHANGED
@@ -83,12 +83,13 @@ module RocketJob
83
83
  autoload :UploadFileJob, "rocket_job/jobs/upload_file_job"
84
84
 
85
85
  module ReEncrypt
86
- autoload :RelationalJob, "rocket_job/jobs/re_encrypt/relational_job"
86
+ autoload :RelationalJob, "rocket_job/jobs/re_encrypt/relational_job"
87
87
  end
88
88
  end
89
89
 
90
90
  module Subscribers
91
91
  autoload :Logger, "rocket_job/subscribers/logger"
92
+ autoload :SecretConfig, "rocket_job/subscribers/secret_config"
92
93
  autoload :Server, "rocket_job/subscribers/server"
93
94
  autoload :Worker, "rocket_job/subscribers/worker"
94
95
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocketjob
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 6.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-24 00:00:00.000000000 Z
11
+ date: 2021-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aasm
@@ -205,6 +205,7 @@ files:
205
205
  - lib/rocket_job/sliced/writer/output.rb
206
206
  - lib/rocket_job/subscriber.rb
207
207
  - lib/rocket_job/subscribers/logger.rb
208
+ - lib/rocket_job/subscribers/secret_config.rb
208
209
  - lib/rocket_job/subscribers/server.rb
209
210
  - lib/rocket_job/subscribers/worker.rb
210
211
  - lib/rocket_job/supervisor.rb