Fix unnecessary queries when batch-removing statuses, 100x faster (#15387)
This commit is contained in:
parent
67ebd61f11
commit
9915d11c0d
7 changed files with 168 additions and 100 deletions
|
@ -36,7 +36,7 @@ class Favourite < ApplicationRecord
|
|||
end
|
||||
|
||||
def decrement_cache_counters
|
||||
return if association(:status).loaded? && (status.marked_for_destruction? || status.marked_for_mass_destruction?)
|
||||
return if association(:status).loaded? && status.marked_for_destruction?
|
||||
status&.decrement_count!(:favourites_count)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue