Browse Source

CLDC-3463: Use find_each in update task to avoid memory problems (#2455)

pull/2456/head
Rachael Booth 7 months ago committed by GitHub
parent
commit
b6f3c2d8ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      lib/tasks/recalculate_vacdays.rake

3
lib/tasks/recalculate_vacdays.rake

@ -1,7 +1,6 @@
desc "Recalculate vacdays after bugfix for daylight savings time changes"
task recalculate_vacdays: :environment do
logs = LettingsLog.where.not(vacdays: nil)
logs.each do |log|
LettingsLog.where.not(vacdays: nil).find_each do |log|
Rails.logger.log("Log #{log.id}")
recalculated_vacdays = log.send(:property_vacant_days)
next if recalculated_vacdays == log.vacdays

Loading…
Cancel
Save