Open mbrinton01 opened 6 years ago
This is a good suggestion, but It's a bad idea to allow this to run in a synchronous way. Mostly the webserver or php itself are setup to only allow to run a single request for a maximum number of seconds or minutes. So if you execute the reindexing through the webserver, and the reindexing takes too long, it will result in a timeout and certain reindex jobs might have stopped halfway in the process.
If this gets implemented, it should start a new php process which runs in a separate thread in the background. The downside is that you won't see the result of this, unless you refresh the page all the time to see if the reindexing is still in progress or has finished.
It also then depends on how the php-cli.ini
file is setup, we always set it up so there isn't a timeout, but I'm pretty sure some hosting companies will also have a certain timeout being defined over there.
We have a build a small module at our office which does this reindexing in an asynchronous way when triggered from the index management screen, but it currently isn't open source, I'll try to figure out if I can share some code from it.
Excellent point. The reindex could easily exceed the server or php timeout for large sites. It will have to be done asynchronously.
This was implemented in https://github.com/magento/magento2/pull/25860 which landed in Magento version 2.4.0
.
Originally recorded in MAGETWO-87804
Requires Merchant Documentation: Yes
Proposed Release Note:
Card:
As a merchant I want to reindex one or more indexes from the Admin Panel so that I can update my site content without having to use the command line or contact a developer.
Background:
In Magento 1, it was possible to reindex one or more indexes from the Admin Panel. This feature was deprecated from the Admin Panel in Magento 2, and it's only possible to reindex sites from the command line using the following commands:
indexer:info
indexer:reindex
indexer:reset
indexer:set-mode
indexer:show-mode
indexer:status
Many merchants cannot reindex from the command line, for several possible reasons:
Merchants who have to contact a developer or Solution Partner to reindex the site may incur additional development cost.
Feature Description:
In the Admin Panel merchants can view Indexes and status through the
System > Index Management
menu. This page shows all indexes, along with the description, mode (save/schedule), status, and last updated timestamp for each index. Merchant users can select one, more than one, or all indexes using the selection grid.A new action should be added named 'Reindex' to the existing action drop-down menu. The existing options are 'Update on Save' and 'Update by Schedule'. If the user selects 'Reindex' a button appears labeled 'Submit'. Next to the button is a status that shows the number of records shown and selected in the grid: 'x records found (x selected)'. When the user clicks 'Submit' the selected indexes are reindexed.
Acceptance Criteria:
Additional Information:
Screenshot showing how feature was possible from M1 Admin Panel:
Screenshot from Magento 2 Admin Panel: