websolute/magento-cron-semaphore

此Magento 2模块允许您通过程序方式暂停和恢复cron执行

安装: 0

依赖项: 0

建议者: 0

安全: 0

星星: 0

观察者: 5

分支: 0

开放问题: 0

类型:magento2-module

1.0.1 2021-03-29 15:33 UTC

This package is auto-updated.

Last update: 2024-09-29 06:21:16 UTC


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();