websolute / magento-cron-semaphore
此Magento 2模块允许您通过程序方式暂停和恢复cron执行
1.0.1
2021-03-29 15:33 UTC
Requires
- magento/framework: *
- magento/module-cron: 100.3.*
README
目的
当您将信号量设置为红色状态时,所有cron作业都将暂停,直到您通过程序调用恢复方法或达到超时限制。
如何使用
只需注入以下管理器
\Websolute\CronSemaphore\Api\CronSempahoreManagerInterface $cronSempahoreManager
使用suspend(int $forSeconds = 300)
命令将信号量设置为红色状态
$this->cronSempahoreManager->suspend();
$this->cronSempahoreManager->suspend(600); // Pass an integer that represents the timeout at 600 seconds
使用resume()
命令将信号量设置为绿色状态
$this->cronSempahoreManager->resume();