• 
      

    Lazily construct avatar and search registries on access.

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

    Information

    Review Board
    release-4.0.x

    Reviewers

    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 ID
    Lazily construct avatar and search registries on access.
    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.
    9583f0d2de1d2cc55a326510d0d898a725923ac0
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-4.0.x (9e5f9ea)