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.1.4.pre.rc18-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc18 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc17-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc17 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc16-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc16 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc15-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc15 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc14-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc14 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc13-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc13 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc12-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc12 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc11-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc11 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc10-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc10 lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc9-java lib/splitclient-rb/redis_metrics_fixer.rb
splitclient-rb-7.1.4.pre.rc9 lib/splitclient-rb/redis_metrics_fixer.rb