Module: ProcessBalancer::Util
Overview
:nodoc:
Instance Method Summary collapse
- #hostname ⇒ Object
- #identity ⇒ Object
- #logger ⇒ Object
- #redis(&block) ⇒ Object
- #start_thread(name, &block) ⇒ Object
- #watchdog ⇒ Object
Instance Method Details
#hostname ⇒ Object
11 12 13 |
# File 'lib/process_balancer/util.rb', line 11 def hostname ProcessBalancer.hostname end |
#identity ⇒ Object
15 16 17 |
# File 'lib/process_balancer/util.rb', line 15 def identity ProcessBalancer.identity end |
#logger ⇒ Object
7 8 9 |
# File 'lib/process_balancer/util.rb', line 7 def logger ProcessBalancer.logger end |
#redis(&block) ⇒ Object
19 20 21 |
# File 'lib/process_balancer/util.rb', line 19 def redis(&block) ProcessBalancer.redis(&block) end |
#start_thread(name, &block) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/process_balancer/util.rb', line 23 def start_thread(name, &block) Thread.new do Thread.current.name = name watchdog(&block) end end |
#watchdog ⇒ Object
30 31 32 33 34 35 |
# File 'lib/process_balancer/util.rb', line 30 def watchdog yield rescue Exception => e # rubocop: disable Lint/RescueException logger.error("#{Thread.current.name} :: #{e.message}") raise e end |