Can I remove indexing from cron:run?
Pregunta
The cron php bin/magento cron:run
is set to run every minute in our project.
Along with various other tasks it runs indexing in Magento. Indexing is part of index cron group.
For debugging purpose all cron groups, which runs can be dumped from execute
method of vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php
. $jobGroupsRoot
variable has all the data related to these groups.
index group has following 3 cron jobs which runs re-indexing and updates mviews.
indexer_reindex_all_invalid
indexer_update_all_views
indexer_clean_all_changelogs
Now my questing is, what will be impacted if I skip/remove these 3 cron jobs when php bin/magento cron:run
runs by modifying vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php
(I will extend this class to modify execute method) ?
I will configure a new cron for php bin/magento indexer:reindex
, which will run once or twice a day.
Solución
The short (and obvious) answer is that rather than your indexes being updated every minute they will only be updated twice daily. What that side affects of that will be for you I guess depends on the website and concurrency of users / frequency of change.
I haven't done this myself so I can't be sure but based on my understanding here are a few examples of things that might happen:
- Frontend inventory levels may not be accurate immediately after they are updated (orders placed, 3rd party integrations etc)
- After a product is categorised in a category that may not come into affect in the frontend immediately after changes
- Flat catalog data may not be up to date with recent changes and therefore changes not reflected on frontend.
- Catalog / sales rules prices may not be accurate immediately after they are turned on.
- New customers will not show up in admin immediately after they are created
Of course to negate this you could also turn all indexes to "Update on Save" rather than "Update on Schedule" this would slow down some frontend requests but should mean that indexes are updated as changes are made.