in lib/crawler/coordinator.rb [276:313]
def crawl_finished?
return true if @crawl_results[@crawl_stage][:outcome]
return false if task_executors.length.positive?
if crawl_queue.empty? && !shutdown_started?
system_logger.info("Crawl queue is empty, finishing the #{@crawl_stage} crawl")
set_outcome(:success, "Successfully finished the #{@crawl_stage} crawl with an empty crawl queue")
return true
end
if shutdown_started?
set_outcome(
:shutdown,
"Terminated the #{@crawl_stage} crawl with #{crawl_queue.length} unprocessed URLs " \
"due to a crawler shutdown (allow_resume=#{allow_resume?})"
)
system_logger.warn("Shutting down the #{@crawl_stage} crawl with #{crawl_queue.length} unprocessed URLs...")
return true
end
if crawl_duration > config.max_duration
outcome_message = <<~OUTCOME.squish
The crawl is taking too long (elapsed:
Shutting down
If you would like to increase the limit, change the max_duration setting.
OUTCOME
set_outcome(:warning, outcome_message)
system_logger.warn(outcome_message)
return true
end
false
end