• 
      

    Delay database access in ExtensionManager.

    Review Request #14767 — Created Jan. 8, 2026 and submitted

    Information

    Djblets
    release-6.x

    Reviewers

    For production code, the ExtensionManager instance is typically
    created as part of application init, because it needs to contribute to
    URLs. This was causing database access to occur before apps were fully
    ready, spewing warnings.

    This change adds a delay_init parameter to the ExtensionManager
    constructor. When this is set to True, we hold off on creating the
    GenerationSynchronizer until later. For unit tests, we pass this in as
    False. For real code, we pass this in as True and then the load()
    method will end up finishing the initialization.

    • Ran unit tests.
    • Ran the Review Board devserver (with some matching changes to that
      codebase) and saw no more errors about early database access.
    Summary ID
    Delay database access in ExtensionManager.
    For production code, the `ExtensionManager` instance is typically created as part of application init, because it needs to contribute to URLs. This was causing database access to occur before apps were fully ready, spewing warnings. This change adds a `delay_init` parameter to the `ExtensionManager` constructor. When this is set to `True`, we hold off on creating the `GenerationSynchronizer` until later. For unit tests, we pass this in as `False`. For real code, we pass this in as `True` and then the `load()` method will end up finishing the initialization. Testing Done: - Ran unit tests. - Ran the Review Board devserver (with some matching changes to that codebase) and saw no more errors about early database access.
    lwzvyznkkpxoyssqqvlslkpxqoxymuzu
    Description From Last Updated

    Should we mention somewhere in the docstrings that if delay_init=True, the caller has to make sure to call load()?

    maubinmaubin

    We should mention in here too that this will be required in Djblets 8.0+.

    maubinmaubin
    maubin
    1. 
        
    2. Show all issues

      Should we mention somewhere in the docstrings that if delay_init=True, the caller has to make sure to call load()?

      1. I don't think we need to. load() already needs to be called during app initialization.

    3. djblets/extensions/manager.py (Diff revision 1)
       
       
       
       
      Show all issues

      We should mention in here too that this will be required in Djblets 8.0+.

    4. 
        
    david
    maubin
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-6.x (f6a4a3b)