Class: EdiProductDataPartnerWorker

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

Overview

Executes one EDI product-data partner per retryable job. The dedicated role
can process four partner feeds concurrently without occupying the latency or
general-heavy processes, while job boundaries release CurrentScope caches and
let Sidekiq honor shutdown between partners.

Instance Method Summary collapse

Instance Method Details

#perform(orchestrator_name, partner) ⇒ Array<Hash>

Executes one product-data flow and records its process-level resource use.

Parameters:

  • orchestrator_name (String)

    concrete EDI orchestrator class name

  • partner (String)

    partner key owned by the orchestrator

Returns:

  • (Array<Hash>)

    result entries returned by the orchestrator dispatcher



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/workers/edi_product_data_partner_worker.rb', line 19

def perform(orchestrator_name, partner)
  started_at = monotonic_time
  rss_before = current_rss_mb
  success = false
  report_event('started', orchestrator_name:, partner:, rss_before_mb: rss_before.round(1))

  result = Edi::BaseOrchestrator.execute_flow(
    :execute_product_data_flow,
    orchestrator_name:,
    partner:,
    raise_on_error: true
  )
  success = true
  result
ensure
  if started_at && rss_before
    record_completion(
      orchestrator_name:,
      partner:,
      started_at:,
      rss_before:,
      success:
    )
  end
end