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 @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"
return true
end
elsif (queue_counter == 0 || process_counter >= @options[:crawl_limit].to_i) && @redis.smembers("currently_running").empty?
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
|