prepare_crawl_task

in lib/crawler/coordinator.rb [332:352]


    def prepare_crawl_task
      return if shutdown_started?

      
      crawl_task = crawl_queue.fetch
      return unless crawl_task

      crawl_task.authorization_header = config.http_header_service.authorization_header_for_url(crawl_task.url)

      
      begin
        task_executors.post do
          execute_crawl_task(crawl_task)
        end
      rescue Concurrent::RejectedExecutionError => e
        system_logger.warn("Failed to schedule a crawl task: #{e}. Going to retry in a second...")
        interruptible_sleep(1)
        retry unless shutdown_started?
      end
    end