mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 08:43:37 +08:00

This is a follow-up to 671f40ce07ebda14e4655cb85ce4794b859023f0 and ed11ee9d057160e5c1b0d1a86c9e94582d8fafd0. While the optimisations in the previous commits were sound, it did not resolve the memory bloat we were seeing. It turns out that we call `.blank?` on the model's result if the model has not been marked optional. The problem with this is that if the model returns an ActiveRecord relation, calling `.blank?` on the relation basically loads everything into memory. Therefore, this commit removes `users` as a model in the since it really isn't a model but just a relation.