Class: Contrast::Agent::ServiceHeartbeat
- Inherits:
-
WorkerThread
- Object
- WorkerThread
- Contrast::Agent::ServiceHeartbeat
- Includes:
- Components::Interface
- Defined in:
- lib/contrast/agent/service_heartbeat.rb
Overview
The ServiceHeartbeat functions to keep the Contrast Service alive and ensure that it maintains this Agent’s ApplicationContext.
Constant Summary collapse
- REFRESH_INTERVAL_SEC =
Spec recommends 30 seconds, we’re going with 15.
15
Instance Method Summary collapse
Methods included from Components::Interface
Methods inherited from WorkerThread
#initialize, #running?, #stop!
Constructor Details
This class inherits a constructor from Contrast::Agent::WorkerThread
Instance Method Details
#poll_message ⇒ Object
32 33 34 |
# File 'lib/contrast/agent/service_heartbeat.rb', line 32 def @_poll_message ||= Contrast::Api::Dtm::Poll.new end |
#start_thread! ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/contrast/agent/service_heartbeat.rb', line 18 def start_thread! return if running? @_thread = Contrast::Agent::Thread.new do logger.info('Starting heartbeat thread.') loop do begin Contrast::Agent.messaging_queue.send_event_eventually() end sleep REFRESH_INTERVAL_SEC end end end |