0
0
Fork 0

Fix/remove calling private method with send in model (#22951)

* fix(status): remove send usage for private unlink_from_conversations

- make unlink_from_conversations public method
- rename unlink_from_conversations to unlink_from_conversations!
- fix send call on private method in statuses_vacuum and batched_remove_status_service

* fix(feeds_vacuum): replace find_in_batches with in_batches

because active record query results should be a little more efficient than
itterating with map and each. Postgres can grasp such lists of ids much quicker
than ruby can.
Will probably make allmost no difference, but cannot hurt either.
This commit is contained in:
Kaspar V 2023-01-11 21:57:24 +01:00 committed by GitHub
parent a65f86ae55
commit ae62e5fa53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 25 deletions

View file

@ -19,9 +19,7 @@ class BatchedRemoveStatusService < BaseService
ActiveRecord::Associations::Preloader.new.preload(statuses_with_account_conversations, [mentions: :account])
statuses_with_account_conversations.each do |status|
status.send(:unlink_from_conversations)
end
statuses_with_account_conversations.each(&:unlink_from_conversations!)
# We do not batch all deletes into one to avoid having a long-running
# transaction lock the database, but we use the delete method instead