Sha256: 3363e7be954f36daac0a684350fc70ef040bb9ff5471e37f43be6ba2e352a439

Contents?: true

Size: 834 Bytes

Versions: 6

Compression:

Stored size: 834 Bytes

Contents

# frozen_string_literal: true

module SplitIoClient
  class RedisMetricsFixer
    def initialize(metrics_repository)
      @metrics_repository = metrics_repository
    end

    def call
      return if ENV['SPLITCLIENT_ENV'] == 'test' || SplitIoClient.configuration.mode == :standalone

      fixer_thread

      if defined?(PhusionPassenger)
        PhusionPassenger.on_event(:starting_worker_process) do |forked|
          fixer_thread if forked
        end
      end
    end

    private

    def fixer_thread
      Thread.new do
        begin
          SplitIoClient.configuration.logger.info('Starting redis metrics fixer')

          @metrics_repository.fix_latencies
        rescue StandardError => error
          SplitIoClient.configuration.log_found_exception(__method__.to_s, error)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
splitclient-rb-6.4.1-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-6.4.1 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-6.4.1.pre.rc3-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-6.4.1.pre.rc3 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-6.4.1.pre.rc2-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-6.4.1.pre.rc2 lib/splitclient-rb/redis_metrics_fixer.rb