mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 03:18:23 +00:00
671f40ce07
This is a follow up to ed11ee9d057160e5c1b0d1a86c9e94582d8fafd0. In `Chat::AutoRemove::HandleCategoryUpdated`, we are currently loading the related users record in batches and then handing it off to `Chat::Action::CalculateMembershipsForRemoval.call`. However, we are still seeing memory spike as a result of this. This commit eliminates the allocation of `User` ActiveRecord objects until absolutely necessary. `Chat::Action::CalculateMembershipsForRemoval.call` has been updated to accept an ActiveRecord relation instead which allows us to avoid the ActiveRecord allocations.