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
4
5
6
|
# File 'lib/switchman_inst_jobs/delayed/worker.rb', line 4
def self.prepended(base)
base.singleton_class.prepend(ClassMethods)
end
|
Instance Method Details
#initialize(options = {}) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/switchman_inst_jobs/delayed/worker.rb', line 8
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.
25
26
27
|
# File 'lib/switchman_inst_jobs/delayed/worker.rb', line 25
def run
shard.activate(:delayed_jobs) { super }
end
|
#shard ⇒ Object
29
30
31
|
# File 'lib/switchman_inst_jobs/delayed/worker.rb', line 29
def shard
self.class.shard(@config[:shard])
end
|
#start ⇒ Object
18
19
20
|
# File 'lib/switchman_inst_jobs/delayed/worker.rb', line 18
def start
shard.activate(:delayed_jobs) { super }
end
|