limited guests: Optimize get_recipients_for_user_creation_events
#27,835 建立於 2023年11月22日
描述
In #27544, whenever a limited guest tries to send a DM to another user, we end up doing a fairly expensive get_accessible_user_ids check, as noted in https://github.com/zulip/zulip/pull/27544#discussion_r1401550500.
Ideally, we'd not do that. I think the best solution might start with #25713, which would allow us to start by checking if we have an existing Huddle object, and if so, skip doing any further authorization check; that would change this from an "every DM" performance issue, which might result in annoying latency, to a "First DM in a new Huddle" one.
But since #25713 might take some time to get organized for, it might make sense to look at just optimizing the queries to filter to the set of relevant users; that'll still be useful even if we do that too.