Class: Contrast::Agent::ReportingWorkers::ApplicationServerWorker

Inherits:
WorkerThread show all
Defined in:
lib/contrast/agent/reporting/reporting_workers/application_server_worker.rb

Overview

The ApplicationServerWorker will send request on interval, to make sure the Agent gets the settings it need to operate, from TS. This Thead should be started after the ApplicationStartup is complete.

Constant Summary collapse

RESEND_INTERVAL_MS =
30_000.cs__freeze

Instance Method Summary collapse

Methods inherited from WorkerThread

#attempt_to_start?, #clean_properties, #initialize, #running?, #stop!

Methods included from Components::Logger::InstanceMethods

#cef_logger, #logger

Constructor Details

This class inherits a constructor from Contrast::Agent::WorkerThread

Instance Method Details

#start_thread!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/contrast/agent/reporting/reporting_workers/application_server_worker.rb', line 15

def start_thread!
  return unless attempt_to_start?
  return if running?

  @_thread = Contrast::Agent::Thread.new do
    logger.info('[ApplicationSettingsWorker] Starting thread.', sending_interval: application_server_ms)
    loop do
      break unless attempt_to_start?

      logger.info('[ApplicationSettingsWorker] Fetching Settings', sending_interval: application_server_ms)
      Contrast::Agent.reporter&.send_event(application_settings_message)
      sleep(application_server_ms / 1000)
    end
  end
end