• 
      

    Avoid too many User queries when calculating ReviewRequestPageData state.

    Review Request #14316 — Created Jan. 30, 2025 and submitted — Latest diff uploaded

    Information

    Review Board
    release-7.1.x

    Reviewers

    We query a lot of objects in ReviewRequestPageData, and many of these
    have User objects associated. These end up being queried as separate
    instances, which means that we lose out on any caching of profiles. This
    ultimately leads to a lot of extra SQL queries per page.

    We now determine all the users we know we have up-front, and then query
    for for anything we're missing. Once we know we have all the users, we
    re-attach the instances to the fetched objects, allowing the same
    instances and cached state to be reused.

    Unit tests pass.

    Verified that the SQL queries on some test review requests have been
    reduced.

    Commits

    Files