Add consolidation of duplicate LocalSiteProfile objects.
Review Request #12471 — Created July 14, 2022 and submitted — Latest diff uploaded
We had two problems that were potentially causing the existence of
duplicateLocalSiteProfilemodels. The first of these is that this
wasn't usingConcurrencyManager, which handles integrity issues across
separate threads (or servers). The second, more difficult one, is that
some databases (particularly MySQL) were ignoring our unique_together
constraint when one of the relations was NULL. This meant it was
possible to end up with multipleLocalSiteProfileobjects with
local_site=None.This change moves us over to
ConcurrencyManager, and implements a
check for the duplicate case when attempting to use
User.get_site_profile. If we do find duplicates, they'll be
consolidated into a single one before returning.
Ran unit tests.