FIX: Avoid `destroy_all` in `Jobs::CleanUpUploads`.
`destroy_all` loads all the relation into memory as once. See https://github.com/rails/rails/issues/22510
This commit is contained in:
parent
27c018e75c
commit
f7322c05ad
|
@ -10,7 +10,7 @@ module Jobs
|
|||
.where("retain_hours IS NULL OR created_at < current_timestamp - interval '1 hour' * retain_hours")
|
||||
.where("created_at < ?", grace_period.hour.ago)
|
||||
.where(url: "")
|
||||
.destroy_all
|
||||
.find_each(&:destroy!)
|
||||
|
||||
return unless SiteSetting.clean_up_uploads?
|
||||
|
||||
|
|
Loading…
Reference in New Issue