Class: Miteru::Jobs::CrawleJob
- Inherits:
-
Object
- Object
- Miteru::Jobs::CrawleJob
- Includes:
- Concerns::DatabaseConnectable, Sidekiq::Job
- Defined in:
- lib/miteru/sidekiq/jobs.rb
Instance Method Summary collapse
Methods included from Concerns::DatabaseConnectable
Instance Method Details
#perform(url, source) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/miteru/sidekiq/jobs.rb', line 16 def perform(url, source) website = Miteru::Website.new(url, source:) with_db_connection do Timeout.timeout(Miteru.config.sidekiq_job_timeout) do result = Crawler.result(website) if result.success? Miteru.logger.info("Crawler:#{website.truncated_url} succeeded.") else Miteru.logger.info("Crawler:#{website.truncated_url} failed - #{result.failure}.") end end end end |