magento2-regenerate_url_rewrites
magento2-regenerate_url_rewrites copied to clipboard
Script slowing down
Describe the bug HI, I am on a MAgento 2.3, with 12412 products in the database. When launching the commande php bin/magento ok:urlrewrites:regenerate --store-id 0, the first 10 seconds, the script generate around 100 products per sec. At 8000 row, the script generate 1 row per sec. Are you aware of this issue?
Just a guess but could it be that your indexes are set to "update on save"? The script is running very fast here, although "only" ~4k products.
Hi, tahks for your answer.
I ahav added 2 addAttributeTofilter on the product collection
->addAttributeToFilter('visibility', array('neq' => \Magento\Catalog\Model\Product\Visibility::VISIBILITY_NOT_VISIBLE))
->addAttributeToFilter('status',\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
to the \OlegKoval\RegenerateUrlRewrites\Model\RegenerateProductRewrites::_getProductsCollection function.
Decreasing from 12k products to 3.8, everyrthing.
Moreover, I think you should skip the generation of the product url if the product name is empty. My client had this issue too, as some
->addAttributeToFilter('name', ['neq' => 'NULL']).
Let me know if that make sense.
BEst,
G