目录
4、 修改magento_operation表结构operation_key 设置成允许为空(主要步骤)。
问题说明:
magento 2.4 BUG 批量修改商品内容后,一直提示 Update attributes for * selected products ,批量操作日志 显示 Not Started 。Pending, in queue... 挂起,队列中......,虽然数据是已经修改了,但是这个提示一直增加无法清除很烦人。
解决方法:
1、首先确认已经正确配置了Cron
crontab -e -uwww #www改成web的授权用户
看到上面的信息代表Cron配置正确
如果没有运行 下面的命令进行配置:
bin/magento cron:install
2、配置
查看现有列表
bin/magento queue:consumers:list
打开 <magento目录>/app/etc/env.php
将列表中的任务添加到env.php中配置如下:
'cron_consumers_runner' => [
'cron_run' => true,
'max_messages' => 2000,
'consumers' => [
'product_action_attribute.update',
'product_action_attribute.website.update',
'exportProcessor',
'inventory.source.items.cleanup',
'inventory.mass.update',
'inventory.reservations.update',
'inventory.reservations.cleanup',
'inventory.reservations.updateSalabilityStatus',
'inventory.indexer.sourceItem',
'inventory.indexer.stock',
'media.content.synchronization',
'media.gallery.synchronization',
'media.storage.catalog.image.resize',
'codegeneratorProcessor'
]
],
3、查看并结束现有 queue:consumers 进程
ps aux | grep -i [c]onsumers
www 2425 0.0 0.0 325620 2788 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start product_action_attribute.update --single-thread --max-messages=10000
www 2427 0.0 0.0 325620 4688 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start product_action_attribute.website.update --single-thread --max-messages=10000
www 2429 0.0 0.0 325620 2776 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start exportProcessor --single-thread --max-messages=10000
www 2431 0.0 0.0 325620 2632 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start inventory.source.items.cleanup --single-thread --max-messages=10000
www 2433 0.0 0.0 326272 2636 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start inventory.mass.update --single-thread --max-messages=10000
www 2435 0.0 0.0 325488 2576 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start inventory.reservations.update --single-thread --max-messages=10000
www 2437 0.0 0.0 325488 2648 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start inventory.reservations.cleanup --single-thread --max-messages=10000
www 2441 0.0 0.0 325620 2644 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start inventory.indexer.sourceItem --single-thread --max-messages=10000
www 2443 0.0 0.0 325620 2572 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start inventory.indexer.stock --single-thread --max-messages=10000
www 2451 0.0 0.0 325488 2812 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start media.content.synchronization --single-thread --max-messages=10000
www 2453 0.0 0.0 325488 2728 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start media.gallery.synchronization --single-thread --max-messages=10000
www 2455 0.0 0.0 325488 2564 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start media.storage.catalog.image.resize --single-thread --max-messages=10000
www 2457 0.0 0.0 325620 2648 ? S Nov16 0:40 php /magento24/bin/magento queue:consumers:start codegeneratorProcessor --single-thread --max-messages=10000
可以看到类似上面的信息
用下面的命令结束进程
kill $(ps aux | grep -i [c]onsumers) #结束所有进程
bin/magento cron:run #重新启动queue:consumers进程
4、 修改magento_operation表结构operation_key 设置成允许为空(主要步骤)。
1)修改db_schema.xml 文件
打开安装目录/vendor/magento/module-asynchronous-operations/etc/db_schema.xml 文件37行,nullable="false" 为 nullable="true"
2)更新应用
bin/magento-cli setup:upgrade
bin/magento-cli setup:di:compile
bin/magento-cli setup:static-content:deploy en_US zh_Hans_CN -f
5、验证结果
批量商品修改,检查状态
6、删除老记录
打开数据库 删除 magento_bulk 表的内容。