Class: Contrast::Agent::ReportingWorkers::ServerSettingsWorker

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

Overview

The ServerSettingsWorker 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 AgentStartup is complete.

Constant Summary collapse

RESEND_INTERVAL_MS =
60_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/server_settings_worker.rb', line 15

def start_thread!
  return unless attempt_to_start?
  return if running?

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

      logger.info('[ServerSettingsWorker] Fetching Settings', sending_interval: server_settings_resend_ms)
      Contrast::Agent.reporter&.send_event(settings_message)
      sleep(server_settings_resend_ms / 1000)
    end
  end
end