commit: 5c8ca024eff76ab10b45df9fd8a95f77ef274d71
parent: d8b2f89d33580045aa3115a86b2a9709760e595a
Author: unarist <m.unarist@gmail.com>
Date: Sat, 7 Oct 2017 03:39:08 +0900
Improve error handling on LinkCrawlWorker (#5250)
* Improve error handling on LinkCrawlWorker
* Ignore TimeoutError and InvalidURIError too
* Record errors to debug log
* Enable dead job queue on LinkCrawlWorker
Since most of acceptable errors were already ignored, only our side issue should go to dead job queue.
* Ignore all http gem errors
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb
@@ -27,7 +27,8 @@ class FetchLinkCardService < BaseService
end
attach_card if @card&.persisted?
- rescue HTTP::ConnectionError, OpenSSL::SSL::SSLError
+ rescue HTTP::Error, Addressable::URI::InvalidURIError => e
+ Rails.logger.debug "Error fetching link #{@url}: #{e}"
nil
end
diff --git a/app/workers/link_crawl_worker.rb b/app/workers/link_crawl_worker.rb
@@ -3,7 +3,7 @@
class LinkCrawlWorker
include Sidekiq::Worker
- sidekiq_options queue: 'pull', retry: false
+ sidekiq_options queue: 'pull', retry: 0
def perform(status_id)
FetchLinkCardService.new.call(Status.find(status_id))