Fix deadlocks during search tests.

Review Request #12053 — Created Feb. 12, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

Search tests which used on-the-fly indexing were hitting deadlocks under
the new haystack version. The problem here was that our indexing
templates were calling get_profile, which would end up creating new
profile objects if they didn't already exist. This would attempt to
write from inside the indexer stack, which would hit a lock.

I've added a new helper that can check if a profile is public without
creating ones that don't exist. Other related code has been updated to
use this new helper appropriately instead of reinventing the wheel.

Ran unit tests.

Diff Revision 1 (Latest)

Commits

First Last Summary ID Author
Fix deadlocks during search tests.
Search tests which used on-the-fly indexing were hitting deadlocks under the new haystack version. The problem here was that our indexing templates were calling `get_profile`, which would end up creating new profile objects if they didn't already exist. This would attempt to write from inside the indexer stack, which would hit a lock. I've added a new helper that can check if a profile is public without creating ones that don't exist. Other related code has been updated to use this new helper appropriately instead of reinventing the wheel. Testing Done: Ran unit tests.
29ea28602c65b474b40b4f71e2405b70337fe709 David Trowbridge
reviewboard/accounts/models.py
reviewboard/accounts/search_indexes.py
reviewboard/templates/search/indexes/auth/user_text.txt
reviewboard/templates/search/indexes/reviews/reviewrequest_text.txt
Loading...