Skip to content

Commit

Permalink
prevent memory leak on destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
murb committed Nov 10, 2023
1 parent 1e7c5d9 commit 9b494a7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def destroy
notice = "De collectie “#{name}” is verwijderd, de werken zijn verplaatst naar de bovenliggende collectie “#{parent_name}”"
end
else
@collection.works.destroy_all
@collection.works.find_in_batches(batch_size: 250).map { |a| a.each(&:destroy) }

@collection.collections.each do |collection|
collection.parent_collection = nil
collection.save
Expand Down

0 comments on commit 9b494a7

Please sign in to comment.