Class: EdiInventoryFlowWorker

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

Instance Method Summary collapse

Instance Method Details

#perform(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/workers/edi_inventory_flow_worker.rb', line 6

def perform(options = {})
  orchestrator_name = options['orchestrator_name'].presence
  partner = options['partner'].presence

  # Enhanced error context with more details
  ErrorReporting.scoped({
    job: self.class.name,
    jid: jid,
    orchestrator_name: orchestrator_name,
    partner: partner,
    options: options,
    worker_start_time: Time.current.iso8601,
    worker_host: Socket.gethostname
  }) do
    Edi::BaseOrchestrator.execute_flow(:execute_inventory_flow, orchestrator_name:, partner:)
  rescue StandardError => e
    # Enhanced error logging with detailed context
    ErrorReporting.error(e, {
      job: self.class.name,
      jid: jid,
      orchestrator_name: orchestrator_name,
      partner: partner,
      options: options,
      error_type: 'inventory_flow_execution_error',
      worker_start_time: Time.current.iso8601,
      worker_host: Socket.gethostname,
      message: "Error executing inventory flow for orchestrator: #{orchestrator_name}, partner: #{partner}"
    })
    raise
  end
end