Skip to content

cron

Auto Added by WPeMatico

How do you create a custom cron job in Magento 2 and ensure it executes only once per cycle?

Here crontab.xml file <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:module:Magento_Cron:etc/crontab.xsd”> <group id=”default”> <job name=”vendor_module_cronjob” instance=”VendorModuleCronCustomJob” method=”execute”> <schedule>* * * * *</schedule> </job> </group> </config> Here CustomJob.php file <?php namespace VendorModuleCron; use PsrLogLoggerInterface; class CustomJob { protected $logger; public function __construct(LoggerInterface $logger) { $this->logger =… Read More »How do you create a custom cron job in Magento 2 and ensure it executes only once per cycle?

Magento 2 Task “Update attributes for 2 selected products”: 1 item(s) are currently being updated.1 item(s) have been scheduled for update

Magento version 2.3.5 Does anyone know how to solve this? Cron is working fine I cross-check with indexing and when run this command – php bin/magento queue:consumers:start product_action_attribute.update then the problem is solved but it’s not a good way, again… Read More »Magento 2 Task “Update attributes for 2 selected products”: 1 item(s) are currently being updated.1 item(s) have been scheduled for update

Method setProductLinks is very slow

I am looping trough 50.000 products. Most with linked items. But it takes forever. It can only handle 1-3 products/second? Is their a faster way than this? ProductLinkInterfaceFactory $productLink, ProductRepositoryInterface $productRepository, *Loop* $linkData = []; $productLink = $this->productLink->create(); $productLink->setSku($SKU) ->setLinkedProductSku($item)… Read More »Method setProductLinks is very slow