Preemptively evaluate values_list queries during counter field updates.

Review Request #12700 — Created Oct. 27, 2022 and submitted — Latest diff uploaded

david
Review Board
release-6.x
reviewboard

We had a couple places when updating review request counters where we'd
fetch a values_list of PKs, and then pass that directly into future
queries, which would end up evaluating them as subqueries. This has two
problems--first, we end up running the subqueries multiple times, and
second, it's impossible to use assertQueries.

This change fixes those up. There are still cases where we have
subqueries that are added by Django's QuerySet.update() method, but
this handles the stuff in our own code.

Verified with assertQueries usage that we no longer had subqueries for
these.

Commits

Files

Loading...