Procházet zdrojové kódy

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
master
unarist před 6 roky
committed by Eugen Rochko
rodič
revize
5c8ca024ef
2 změnil soubory, kde provedl 3 přidání a 2 odebrání
  1. +2
    -1
      app/services/fetch_link_card_service.rb
  2. +1
    -1
      app/workers/link_crawl_worker.rb

+ 2
- 1
app/services/fetch_link_card_service.rb Zobrazit soubor

@@ -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



+ 1
- 1
app/workers/link_crawl_worker.rb Zobrazit soubor

@@ -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))


Načítá se…
Zrušit
Uložit