Module: RocketJob::Batch::Statistics

Extended by:
ActiveSupport::Concern
Included in:
Jobs::OnDemandBatchJob
Defined in:
lib/rocket_job/batch/statistics.rb

Overview

Allow statistics to be gathered while a batch job is running.

Notes:

  • Statistics for successfully processed records within a slice are saved.

  • Statistics gathered during a perform that then results in an exception are discarded.

Defined Under Namespace

Classes: Stats

Instance Method Summary collapse

Instance Method Details

#statistics_inc(key, increment = 1) ⇒ Object

Increment a statistic



67
68
69
70
71
# File 'lib/rocket_job/batch/statistics.rb', line 67

def statistics_inc(key, increment = 1)
  return if key.nil? || key == ""

  (@rocket_job_perform_statistics ||= []) << (key.is_a?(Hash) ? key : [key, increment])
end