Lazily construct avatar and search registries on access.

Review Request #10512 — Created April 4, 2019 and submitted

chipx86
Review Board
release-4.0.x
reviewboard

We'd previously import and construct the avatar and search registries
when loading the reviewboard.avatars and reviewboard.search apps for
the first time. In modern versions of Django, this breaks app
initialization, since the imports end up importing other uninitialized
apps, resulting in hard-to-diagnose error messages.

To work around this, we now lazily import and construct the registries
when they're first needed. This has a side benefit of reducing the
startup load, even if just a bit. To do this, we use the new
lazy_import_registry() function in Djblets, which will construct a
wrapper around on the registries that does the import and construction
on first access, which will be some time after Django initialization has
completed.

Unit tests pass on Django 1.6 and 1.11 (with other in-progress changes).

Summary
Lazily construct avatar and search registries on access.
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (9e5f9ea)
Loading...