Fix excess queries and audit code for the datagrids.

Review Request #13366 — Created Oct. 22, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

The new query tests for the datagrids unveiled a number of excess
queries when working with Local Sites. We were querying one Local Site
per row when viewing any review request datagrid on a Local Site. This
was due to the lack of any select_related or equivalent.

This change fixes that, significantly reducing the overhead and the
removing the padded excess queries in the unit tests.

In the process, I've audited the code, cleaned up some calls to help
avoid potential problems down the road, and reduced additional queries
that involved Local Sites, helping keep queries simpler on a standard
setup.

Unit tests pass.

Tested all the datagrids, making sure there were no apparent regressions.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Fix excess queries and audit code for the datagrids.
The new query tests for the datagrids unveiled a number of excess queries when working with Local Sites. We were querying one Local Site per row when viewing any review request datagrid on a Local Site. This was due to the lack of any `select_related` or equivalent. This change fixes that, significantly reducing the overhead and the removing the padded excess queries in the unit tests. In the process, I've audited the code, cleaned up some calls to help avoid potential problems down the road, and reduced additional queries that involved Local Sites, helping keep queries simpler on a standard setup.
daa5ea4d9ce8b47a1989df62c91a7ea9e30d0446 Christian Hammond
reviewboard/datagrids/grids.py
reviewboard/datagrids/tests/test_all_review_requests.py
reviewboard/datagrids/tests/test_dashboard.py
reviewboard/datagrids/tests/test_user_page.py
reviewboard/datagrids/tests/test_users_list.py
Loading...