Class: CopycopterClient::ProcessGuard
- Inherits:
-
Object
- Object
- CopycopterClient::ProcessGuard
- Defined in:
- lib/copycopter_client/process_guard.rb
Overview
Starts the poller from a worker process, or register hooks for a spawner process (such as in Unicorn or Passenger). Also registers hooks for exiting processes and completing background jobs. Applications using the client will not need to interact with this class directly.
Instance Method Summary collapse
-
#initialize(cache, poller, options) ⇒ ProcessGuard
constructor
A new instance of ProcessGuard.
-
#start ⇒ Object
Starts the poller or registers hooks.
Constructor Details
#initialize(cache, poller, options) ⇒ ProcessGuard
Returns a new instance of ProcessGuard.
9 10 11 12 13 |
# File 'lib/copycopter_client/process_guard.rb', line 9 def initialize(cache, poller, ) @cache = cache @poller = poller @logger = [:logger] end |
Instance Method Details
#start ⇒ Object
Starts the poller or registers hooks
16 17 18 19 20 21 22 23 24 |
# File 'lib/copycopter_client/process_guard.rb', line 16 def start if spawner? register_spawn_hooks else register_exit_hooks register_job_hooks start_polling end end |