Class: ActiveRecord::Materialized::ReconcileJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/activerecord/materialized/reconcile_job.rb

Overview

ActiveJob wrapper that reconciles a single view on a background worker — the per-view fan-out unit for the periodic bounded-staleness backstop across a fleet, mirroring RefreshJob for the write path.

Instance Method Summary collapse

Instance Method Details

#perform(view_key, mode: :checksum, sample: nil) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/activerecord/materialized/reconcile_job.rb', line 11

def perform(view_key, mode: :checksum, sample: nil)
  view_class = Registry.find(view_key)
  return if view_class.nil?
  # Another server in the fleet may have refreshed or reconciled it since this
  # job was enqueued; skip the redundant (expensive) verification if so.
  return unless view_class.stale?

  view_class.reconcile!(mode: mode, sample: sample)
end