Skip to content

Commit

Permalink
refactor: update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoseki committed Jan 28, 2024
1 parent 451f80d commit df2f7f9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/miteru/orchestrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ def call
Miteru.logger.info("#{websites.length} websites loaded in total.") if verbose?

if Miteru.sidekiq?
websites.each { |website| Jobs::CrawleJob.perform_async(website.url, website.source) }

websites.each do |website|
Jobs::CrawleJob.perform_async(website.url, website.source)
Miteru.logger.info("Website:#{website.truncated_url} crawler job queued") if verbose?
end
else
Miteru.logger.info("Use #{threads} thread(s).") if verbose?
Parallel.each(websites, in_threads: threads) { |website| crawl(website) }
Parallel.each(websites, in_threads: threads) do |website|
Miteru.logger.info("Website:#{website.truncated_url} crawling started") if verbose?
crawl(website)
end
end
end

Expand Down

0 comments on commit df2f7f9

Please sign in to comment.