Sha256: a31bf1a37972cdb5a2d9460900632bfc7eee0d931f6d094368c168ba46ef6857

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 Bytes

Contents

module Typhoeus
  class Hydra
    def run_with_logging
      log = LazyResource.debug && LazyResource.logger && @multi.active > 0 && @multi.running <= 0
      if log
        LazyResource.logger.info "Processing requests:"
        start_time = Time.now
      end

      run_without_logging

      if log
        LazyResource.logger.info "Requests processed in #{((Time.now - start_time) * 1000).ceil}ms"
      end
    end

    alias_method :run_without_logging, :run
    alias_method :run, :run_with_logging
  end

  class Multi
    attr_reader :active, :running
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lazy_resource-0.3.3 lib/lazy_resource/ext/typhoeus.rb
lazy_resource-0.3.2 lib/lazy_resource/ext/typhoeus.rb