The GetTeamsUnreadForUser call would be called for every team switch. In CRT mode, it would make a separate store call for every team, which would run the 3 aggregate SQL queries in GetThreadsForUser. This is suboptimal because the complexity is linearly proportional to the number of teams. We make the following optimizations: 1. Change the query to a single one which aggregates all teams. 2. The query originally used just 2 out of the 3 queries, so one query was fully redundant. We remove that query in the new one. 3. Further analysis was done whether it makes sense to run the 2 queries synchronously or not. The load-tests didn't show any degradation in running them concurrently, so we keep the same behavior. ```release-note NONE ```
310 KiB
310 KiB