Class: ListingIssueSyncWorker

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

Overview

Reconciles ListingIssue rows for every marketplace provider via
ListingIssues::Sync. Scheduled daily just before the retailer-compliance
report so its "Listing Issues" column and the CRM Listing Issues dashboard
reflect the latest channel-reported problems. Reads already-pulled data only
(no external API calls), so it's cheap and safe to retry.

Instance Method Summary collapse

Instance Method Details

#performObject



16
17
18
19
20
21
22
23
24
25
# File 'app/workers/listing_issue_sync_worker.rb', line 16

def perform
  # Serialize runs so an overlapping schedule/retry/manual enqueue can't
  # double-reconcile the same items concurrently (matches the campaign-sync
  # workers' pattern). A run we skip is harmless — the next one reconciles.
  ListingIssue.with_advisory_lock('listing_issues_sync', timeout_seconds: 10) do
    results = ListingIssues::Sync.run(logger:)
    summary = results.transform_values(&:to_h)
    logger.info "[ListingIssueSyncWorker] complete: #{summary}"
  end
end