Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Additional Measure to Ensure Indexers Remain in Locked Mode #9

Merged
merged 8 commits into from
Feb 25, 2023

Conversation

pykettk
Copy link
Owner

@pykettk pykettk commented Feb 25, 2023

Description

Resolves #8

  • Added a fallback cron that checks indexers are in the mode they should be, according to deploy config
    • Added system config to toggle this functionality on or off (default)
  • Refactored the indexer plugin to target more appropriate functions to catch more cases of indexer modes being changed
  • Added additional helper functions to the indexer config model to help with the above implementations
  • Updates plugin configuration to exist in all non-global scopes

@pykettk
Copy link
Owner Author

pykettk commented Feb 25, 2023

Reverted to draft while I investigate an issue with the plugin. The before plugins are causing the following error when running setup:upgrade:

Notice: Trying to access array offset on value of type null in /var/www/html/vendor/magento/framework/Mview/View/Subscription.php on line 307

EDIT: I think the issue might be that Magento wants to set all indexers to Save during setup:upgrade, perform some actions, and then set them back to their original state once done - but the plugin isn't letting it happen.


EDIT 2: I think the above is along the right track. By scoping the plugin to all but the global area, setup:upgrade is able to complete successfully. I think I'm okay with this as a solution though would be happy for anyone to correct me and offer an alternative 🙂

The setup:upgrade command cannot complete when the before plugins execute
in the global scope. From some initial investigation; it would seem that,
during the execution of this command, Magento wants to (and expects)
indexers to be set to update on save but these plugins were preventing
that from happening - thus causing an exception.

Scoping these plugins to the different areas of the application does not
pose this problem - which is a solution I am okay with at the moment.

Happy for somebody to correct me and/or provide a better alternative
solution.
@pykettk pykettk marked this pull request as ready for review February 25, 2023 16:00
@pykettk pykettk merged commit e980985 into master Feb 25, 2023
@pykettk pykettk deleted the extra-indexer-mode-safeguards branch February 25, 2023 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent automatic indexers non wanted change from schedule to save mode
1 participant