websolute / magento-cron-semaphore
This Magento 2 Module allows you to suspend and resume the cron execution programmatically
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Type:magento2-module
Requires
- magento/framework: *
- magento/module-cron: 100.3.*
README
Purpose
When you put the semaphore in red status, all the cron jobs are suspended until you programmatically call the resume method or after the timeout limit.
How to use
Just inject the following manager:
\Websolute\CronSemaphore\Api\CronSempahoreManagerInterface $cronSempahoreManager
The use the suspend(int $forSeconds = 300)
command to put the semaphore in red status:
$this->cronSempahoreManager->suspend();
$this->cronSempahoreManager->suspend(600); // Pass an integer that represents the timeout at 600 seconds
The use the resume()
command to put the semaphore in green status:
$this->cronSempahoreManager->resume();