Sha256: ad564fde1935586ccfc9174fe4bc42fe380d6aac0e81b2e71c82030add846c32

Contents?: true

Size: 970 Bytes

Versions: 26

Compression:

Stored size: 970 Bytes

Contents

# frozen_string_literal: true

module SplitIoClient
  module Telemetry
    class SyncTask
      def initialize(config, telemetry_synchronizer)
        @config = config
        @telemetry_synchronizer = telemetry_synchronizer
      end

      def call
        stats_thread

        PhusionPassenger.on_event(:starting_worker_process) { |forked| stats_thread if forked } if defined?(PhusionPassenger)
      end

      private

      def stats_thread
        @config.threads[:telemetry_stats_sender] = Thread.new do
          begin
            @config.logger.info('Starting Telemetry Sync Task')

            loop do
              sleep(@config.telemetry_refresh_rate)

              @telemetry_synchronizer.synchronize_stats
            end
          rescue SplitIoClient::SDKShutdownException
            @telemetry_synchronizer.synchronize_stats

            @config.logger.info('Posting Telemetry due to shutdown')
          end
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
splitclient-rb-7.3.3.pre.rc2-java lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.3.pre.rc2 lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2-java lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2 lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2.pre.rc5-java lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2.pre.rc5 lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2.pre.rc4-java lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2.pre.rc4 lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2.pre.rc3-java lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2.pre.rc3 lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2.pre.rc2-java lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2.pre.rc2 lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2.pre.rc1-java lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.2.pre.rc1 lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.1-java lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.1 lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.1.pre.rc1-java lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.1.pre.rc1 lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.0-java lib/splitclient-rb/telemetry/sync_task.rb
splitclient-rb-7.3.0 lib/splitclient-rb/telemetry/sync_task.rb