Class: MatViews::CreateViewJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- MatViews::CreateViewJob
- Defined in:
- app/jobs/mat_views/create_view_job.rb
Overview
ActiveJob that handles creation of PostgreSQL materialised views for a given MatViewDefinition.
The job:
-
Normalizes the ‘force` argument.
-
Looks up the target MatViewDefinition.
-
Starts a MatViewRun row to track lifecycle/timing, with ‘operation: :create`.
-
Executes Services::CreateView.
-
Finalizes the run with success/failure, duration, and meta.
Instance Method Summary collapse
-
#perform(mat_view_definition_id, force_arg = nil, row_count_strategy_arg = nil) ⇒ Hash
Perform the create job for the given materialised view definition.
Instance Method Details
#perform(mat_view_definition_id, force_arg = nil, row_count_strategy_arg = nil) ⇒ Hash
Perform the create job for the given materialised view definition.
59 60 61 62 63 64 65 66 67 |
# File 'app/jobs/mat_views/create_view_job.rb', line 59 def perform(mat_view_definition_id, force_arg = nil, row_count_strategy_arg = nil) definition = MatViews::MatViewDefinition.find(mat_view_definition_id) record_run(definition, :create) do MatViews::Services::CreateView.new(definition, force: force?(force_arg), row_count_strategy: normalize_strategy(row_count_strategy_arg)).call end end |