Class: RetailerUrlRediscoveryWorker
- Inherits:
-
Object
- Object
- RetailerUrlRediscoveryWorker
- Includes:
- Sidekiq::Job
- Defined in:
- app/workers/retailer_url_rediscovery_worker.rb
Overview
Re-finds a stale product URL after a probe failed, then re-probes it.
Enqueued by Retailer::WebhookResultProcessor when a probe comes back as a
URL-type failure (the stored URL no longer resolves to our product) and the
retailer has a rediscovery strategy. The enqueue is throttled there (once per
item / 7 days) so a still-broken item can't loop probe → fail → rediscover.
Instance Method Summary collapse
Instance Method Details
#perform(catalog_item_id) ⇒ void
This method returns an undefined value.
18 19 20 21 22 23 24 25 26 27 |
# File 'app/workers/retailer_url_rediscovery_worker.rb', line 18 def perform(catalog_item_id) catalog_item = CatalogItem.find_by(id: catalog_item_id) return unless catalog_item return unless Retailer::UrlRediscovery.attempt(catalog_item) # A fresh URL deserves a fresh chance: clear the auto-skip flag a repeated # failure may have set, then re-probe the new URL via the normal funnel. catalog_item.update_columns(skip_url_checks: false) if catalog_item.skip_url_checks? RetailerProbeWorker.perform_async(catalog_item_id: catalog_item.id) end |