• 
      

    Fix issues when switching and validating search backends.

    Review Request #13389 — Created Oct. 30, 2023 and submitted

    Information

    Review Board
    release-5.0.x

    Reviewers

    When switching to a new search backend, validation could fail due to the
    search backends attempting to access the "default" connection, which is
    the forwarding backend, and then failing to find the right engine
    information.

    To address this, we now register a new, empty connection alias. We set
    this to the new engine and configuration, and then validate using that.
    This gives the backend a stable connection to hold onto.

    This makes use of modern Haystack's ability to modify and reload a
    registered connection, which is the original purpose of the forwarding
    backend. This is the reason we're not just using the forwarding backend
    for this purpose. However, the forwarding backend is also more complex,
    loading state from the site configuration and handling cache-based
    syncing, with fallbacks on errors. We don't need or want all that, so we
    just work with what Haystack provides us.

    Tested switching between backends, with successful and failed validation
    attempts. I no longer had any issues. I also added temporary logging to
    Haystack to verify configuration and connection states.

    Summary ID
    Fix issues when switching and validating search backends.
    When switching to a new search backend, validation could fail due to the search backends attempting to access the "default" connection, which is the forwarding backend, and then failing to find the right engine information. To address this, we now register a new, empty connection alias. We set this to the new engine and configuration, and then validate using that. This gives the backend a stable connection to hold onto. This makes use of modern Haystack's ability to modify and reload a registered connection, which is the original purpose of the forwarding backend. This is the reason we're not just using the forwarding backend for this purpose. However, the forwarding backend is also more complex, loading state from the site configuration and handling cache-based syncing, with fallbacks on errors. We don't need or want all that, so we just work with what Haystack provides us.
    1fc9d892b007d4726f3231c9c719da54ca9714bf
    Description From Last Updated

    undefined name 'connections' Column: 9 Error code: F821

    reviewbot reviewbot

    undefined name 'connections' Column: 9 Error code: F821

    reviewbot reviewbot

    undefined name 'connections' Column: 13 Error code: F821

    reviewbot reviewbot
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    chipx86
    david
    1. Ship It!
    2. 
        
    maubin
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.0.x (7276c4c)