Class: EdiProductDataFlowFinalizer

Inherits:
Object
  • Object
show all
Defined in:
app/workers/edi_product_data_flow_finalizer.rb

Overview

Sidekiq Pro batch callback for the actual partner jobs. The scheduled
dispatcher check-in proves the cron fired; this callback records when the
complete product-data flow finished and whether any partner exhausted retries.

Instance Method Summary collapse

Instance Method Details

#on_complete(status, options) ⇒ void

This method returns an undefined value.

Reports the outcome of the completed partner batch.

Parameters:

  • status (Sidekiq::Batch::Status)

    completed batch state

  • options (Hash)

    callback metadata from the dispatcher

Options Hash (options):

  • 'started_at' (String)

    ISO8601 dispatch timestamp

  • 'target_count' (Integer)

    number of partner jobs dispatched



14
15
16
17
18
19
20
21
# File 'app/workers/edi_product_data_flow_finalizer.rb', line 14

def on_complete(status, options)
  duration = Time.current - Time.iso8601(options.fetch('started_at'))
  failures = status.failures.to_i
  target_count = options.fetch('target_count').to_i

  ErrorReporting.error("EDI product-data batch #{status.bid}: #{failures} partner job(s) failed") if failures.positive?
  report_completion(status:, target_count:, failures:, duration:)
end