Sha256: 39a7efe6e9009c1893348aaaef4359c37ee6547aaa43558f48aedeb1e7c169a3

Contents?: true

Size: 805 Bytes

Versions: 158

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true

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

    def call
      return if ENV['SPLITCLIENT_ENV'] == 'test' || @config.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
          @config.logger.info('Starting redis metrics fixer')

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

Version data entries

158 entries across 158 versions & 1 rubygems

Version Path
splitclient-rb-7.2.3-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.3 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.3.pre.rc2-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.3.pre.rc2 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.3.pre.rc1-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.3.pre.rc1 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.2-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.2 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.2.pre.rc1-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.2.pre.rc1 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.1-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.1 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.1.pre.rc1-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.1.pre.rc1 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.0.pre.rc1-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.0.pre.rc1 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.0-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.2.0 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc19-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc19 lib/splitclient-rb/redis_metrics_fixer.rb