Method: CobwebModule::Crawl#finished?

Defined in:
lib/crawl.rb

#finished?Boolean

Returns:

  • (Boolean)


208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/crawl.rb', line 208

def finished?
  print_counters
  debug_puts @stats.get_status
  if @stats.get_status == CobwebCrawlHelper::FINISHED
    debug_puts "Already Finished!"
  end  
  # if there's nothing left queued or the crawled limit has been reached and we're not still processing something
  if @options[:crawl_limit].nil? || @options[:crawl_limit] == 0
    if queue_counter == 0 && @redis.smembers("currently_running").empty?
      debug_puts "queue_counter is 0 and currently_running is empty so we're done"
      #finished
      return true
    end
  elsif (queue_counter == 0 || process_counter >= @options[:crawl_limit].to_i) && @redis.smembers("currently_running").empty?
    #finished
    debug_puts "queue_counter: #{queue_counter}, @redis.smembers(\"currently_running\").empty?: #{@redis.smembers("currently_running").empty?}, process_counter: #{process_counter}, @options[:crawl_limit].to_i: #{@options[:crawl_limit].to_i}"
    return true
  end
  false
end