<commit_before>require 'connection_pool'
require 'redis'
require 'metriks'
 
module Travis
  class RedisPool
    attr_reader :pool

    def initialize(options = {})
      pool_options = options.delete(:pool) || {}
      pool_options[:size] ||= 10
      pool_options[:timeout] ||= 10
      @pool = ConnectionPool.new(pool_options) do
        ::Redis.new(options)
      end
    end
   
    def method_missing(name, *args)
      timer = Metriks.timer('redis.pool.wait').time
      @pool.with do |redis|
        timer.stop
        if redis.respond_to?(name)
          Metriks.timer("redis.operations").time do
            redis.send(name, *args)
          end
        else
          super
        end
      end
    end
  end
end<commit_msg>pass through a given block in RedisPool#method_missing<commit_after>require 'connection_pool'
require 'redis'
require 'metriks'

module Travis
  class RedisPool
    attr_reader :pool

    def initialize(options = {})
      pool_options = options.delete(:pool) || {}
      pool_options[:size] ||= 10
      pool_options[:timeout] ||= 10
      @pool = ConnectionPool.new(pool_options) do
        ::Redis.new(options)
      end
    end

    def method_missing(name, *args, &block)
      timer = Metriks.timer('redis.pool.wait').time
      @pool.with do |redis|
        timer.stop
        if redis.respond_to?(name)
          Metriks.timer("redis.operations").time do
            redis.send(name, *args, &block)
          end
        else
          super
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10819672131147541, 'fraction_numerical': 0.005245901639344262, 'mean_word_length': 2.253731343283582, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6477692', 'n_tokens_mistral': 489, 'n_tokens_neox': 478, 'n_words': 105}