Class: Raif::RepairInferenceCostEventsJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/raif/repair_inference_cost_events_job.rb

Overview

Self-healing for inference cost events: creates events for terminal Raif::ModelCompletion records that are missing one and re-syncs events that are stale (older than their completion). Enqueued whenever a live sync fails (see Raif::ModelCompletion#sync_inference_cost_event, which never fails the completion save); hosts should also schedule it periodically, especially with archiving enabled - the archive job never culls a terminal completion whose event is missing or stale, so this job is what makes those rows eligible again.

Idempotent: runs the same scope and sync path as Raif::InferenceCostEvent.backfill!, so concurrent or repeated runs converge on one fresh event per terminal completion.

Instance Method Summary collapse

Instance Method Details

#perform(batch_size: 500) ⇒ Object



25
26
27
# File 'app/jobs/raif/repair_inference_cost_events_job.rb', line 25

def perform(batch_size: 500)
  Raif::InferenceCostEvent.backfill!(batch_size: batch_size)
end