Module: SwitchmanInstJobs::Delayed::Worker
- Defined in:
- lib/switchman_inst_jobs/delayed/worker.rb,
lib/switchman_inst_jobs/delayed/worker/health_check.rb
Defined Under Namespace
Modules: ClassMethods, HealthCheck
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.prepended(base) ⇒ Object
6
7
8
|
# File 'lib/switchman_inst_jobs/delayed/worker.rb', line 6
def self.prepended(base)
base.singleton_class.prepend(ClassMethods)
end
|
Instance Method Details
#initialize(options = {}) ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/switchman_inst_jobs/delayed/worker.rb', line 10
def initialize(options = {})
@config = options
::Delayed::Worker::HealthCheck.munge_service_name(shard) do
super
@health_check_config = @health_check_config.dup
end
end
|
#run ⇒ Object
Worker#run is usually only called from Worker#start, but if the worker is called directly from the console, we want to make sure it still gets the right shard activated.
27
28
29
|
# File 'lib/switchman_inst_jobs/delayed/worker.rb', line 27
def run
shard.activate(::Delayed::Backend::ActiveRecord::AbstractJob) { super }
end
|
#shard ⇒ Object
31
32
33
|
# File 'lib/switchman_inst_jobs/delayed/worker.rb', line 31
def shard
self.class.shard(@config[:shard])
end
|
#start ⇒ Object
20
21
22
|
# File 'lib/switchman_inst_jobs/delayed/worker.rb', line 20
def start
shard.activate(::Delayed::Backend::ActiveRecord::AbstractJob) { super }
end
|