Class: ListingIssueRefreshWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/workers/listing_issue_refresh_worker.rb

Overview

On-demand "Recheck" for a single catalog item from the CRM Listing Issues
dashboard: re-pulls the item's marketplace listing data and re-reconciles its
ListingIssue rows, so a reviewer can clear stale issues without waiting for
the nightly sync.

Amazon: pull fresh listing + catalog data (refreshes the SP-API issues
array + suppression), re-derive the has_issues flag (resolving one Amazon no
longer reports), then mirror into listing_issues. For any provider, the final
ListingIssues::Sync.run_for reconciles the item — auto-resolving issues the
provider no longer reports.

Runs on the rate-limited :amazon_api queue. Deduped per item until the active
pull finishes, so webhook bursts and double-clicks collapse to one pull.
A duplicate is expected coalescing, not a failed job, and is logged without
being added to Sidekiq's dead set.

Instance Method Summary collapse

Instance Method Details

#perform(catalog_item_id) ⇒ void

This method returns an undefined value.

Parameters:

  • catalog_item_id (Integer)


30
31
32
33
34
35
36
# File 'app/workers/listing_issue_refresh_worker.rb', line 30

def perform(catalog_item_id)
  catalog_item = CatalogItem.find_by(id: catalog_item_id)
  return unless catalog_item

  refresh_amazon(catalog_item) if catalog_item.amazon_catalog_item?
  ListingIssues::Sync.run_for(catalog_item)
end