Commit 6d0b7bab authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Disable replace_methods in users autocomplete

We only need the availability String itself so defining all the String
methhods onto the lazy object is a waste.

We also don't do pagination on this endpoint. So on projects with a lot
of members this endpoint is very slow and consumes a lot of memory.

Changelog: performance
parent 417c9c00
...@@ -83,7 +83,7 @@ module Users ...@@ -83,7 +83,7 @@ module Users
end end
def lazy_user_availability(user) def lazy_user_availability(user)
BatchLoader.for(user.id).batch do |user_ids, loader| BatchLoader.for(user.id).batch(replace_methods: false) do |user_ids, loader|
user_ids.each_slice(1_000) do |sliced_user_ids| user_ids.each_slice(1_000) do |sliced_user_ids|
UserStatus UserStatus
.select(:user_id, :availability) .select(:user_id, :availability)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment