Sha256: 6277f6781a576278326ba602dae7ddd09d7789f08b246126607eee7e55f2440f

Contents?: true

Size: 812 Bytes

Versions: 46

Compression:

Stored size: 812 Bytes

Contents

module Picky

  # Helper methods for measuring, benchmarking, logging.
  #
  module Helpers
    module Indexing

      include Measuring
      
      # Runs the block and logs a few infos regarding the time it took.
      #
      def timed_indexing scheduler, &block
        Picky.logger.info "Picky is indexing using #{scheduler.fork? ? 'multiple processes' : 'a single process'}: "
        Picky.logger.info " Done in #{timed(&block).round}s.\n"
      end
      
      # Indexing works the same way, always:
      #  * Prepare the scheduler.
      #  * Cache the scheduler.
      #
      def index scheduler = Scheduler.new
        timed_indexing scheduler do
          prepare scheduler
          scheduler.finish

          cache scheduler
          scheduler.finish
        end
      end

    end
  end

end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
picky-4.8.1 lib/picky/helpers/indexing.rb
picky-4.8.0 lib/picky/helpers/indexing.rb
picky-4.7.0 lib/picky/helpers/indexing.rb
picky-4.6.6 lib/picky/helpers/indexing.rb
picky-4.6.5 lib/picky/helpers/indexing.rb
picky-4.6.4 lib/picky/helpers/indexing.rb