Class: ActiveJob::Temporal::Cancel::BatchCanceller
- Inherits:
-
Object
- Object
- ActiveJob::Temporal::Cancel::BatchCanceller
- Defined in:
- lib/activejob/temporal/cancel/batch_canceller.rb
Constant Summary collapse
- PAGE_SIZE =
100- TERMINATION_CONCURRENCY =
5- MAX_REPORTED_ERRORS =
BatchSummary::MAX_REPORTED_ERRORS
- TERMINATION_REASON =
"ActiveJob::Temporal.cancel_where"- SEARCH_ATTRIBUTE_TYPES =
{ "ajClass" => :keyword, "ajQueue" => :keyword, "ajJobId" => :keyword, "ajEnqueuedAt" => :datetime, "ajTenantId" => :integer }.freeze
Instance Method Summary collapse
- #cancel_where(filters) ⇒ Object
-
#initialize(client) ⇒ BatchCanceller
constructor
A new instance of BatchCanceller.
Constructor Details
#initialize(client) ⇒ BatchCanceller
Returns a new instance of BatchCanceller.
21 22 23 |
# File 'lib/activejob/temporal/cancel/batch_canceller.rb', line 21 def initialize(client) @client = client end |
Instance Method Details
#cancel_where(filters) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/activejob/temporal/cancel/batch_canceller.rb', line 25 def cancel_where(filters) query = workflows_query(normalize_filters(filters)) summary = BatchSummary.new each_workflow_page(query) do |workflow_executions| terminate_workflows(workflow_executions, summary) end summary.to_h rescue ArgumentError raise rescue StandardError => e raise ActiveJob::Temporal::TemporalConnectionError, "Failed to query Temporal workflows for batch cancellation: #{e.}" end |