Class: ActiveJob::Temporal::Cancel::BatchSummary
- Inherits:
-
Object
- Object
- ActiveJob::Temporal::Cancel::BatchSummary
- Defined in:
- lib/activejob/temporal/cancel/batch_summary.rb
Constant Summary collapse
- MAX_REPORTED_ERRORS =
100
Instance Method Summary collapse
-
#initialize ⇒ BatchSummary
constructor
A new instance of BatchSummary.
- #record_failure(workflow_id, run_id, error) ⇒ Object
- #record_terminated ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ BatchSummary
Returns a new instance of BatchSummary.
9 10 11 12 |
# File 'lib/activejob/temporal/cancel/batch_summary.rb', line 9 def initialize @mutex = Mutex.new @value = { terminated: 0, failed: 0, errors: [] } end |
Instance Method Details
#record_failure(workflow_id, run_id, error) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/activejob/temporal/cancel/batch_summary.rb', line 18 def record_failure(workflow_id, run_id, error) mutex.synchronize do value[:failed] += 1 if value[:errors].length < MAX_REPORTED_ERRORS value[:errors] << cancellation_error(workflow_id, run_id, error) end end end |
#record_terminated ⇒ Object
14 15 16 |
# File 'lib/activejob/temporal/cancel/batch_summary.rb', line 14 def record_terminated mutex.synchronize { value[:terminated] += 1 } end |
#to_h ⇒ Object
27 28 29 |
# File 'lib/activejob/temporal/cancel/batch_summary.rb', line 27 def to_h value end |