Skip to content

Commit

Permalink
Clean Alerts with "delete_all"
Browse files Browse the repository at this point in the history
The destroy_all call was not adequate for the high volume of data, as
instantiates each record in memory.

Delete all executes everything with a single SQL query (what I
originally intended and missed).
  • Loading branch information
scruti committed Jan 14, 2025
1 parent 0a32162 commit 9af5aeb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/jobs/delete_old_alert_runs_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ class DeleteOldAlertRunsJob < ApplicationJob
queue_as :low

def perform
AlertRun.where(run_on: ...1.week.ago).destroy_all
AlertRun.where(run_on: ...1.week.ago).delete_all
end
end

0 comments on commit 9af5aeb

Please sign in to comment.