Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__construct (\Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Cron\Model\ScheduleFactory $scheduleFactory, \Magento\Framework\App\CacheInterface $cache, \Magento\Cron\Model\ConfigInterface $config, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\App\Console\Request $request, \Magento\Framework\ShellInterface $shell, \Magento\Framework\Stdlib\DateTime\DateTime $dateTime, \Magento\Framework\Process\PhpExecutableFinderFactory $phpExecutableFinderFactory, \Psr\Log\LoggerInterface $logger, \Magento\Framework\App\State $state, StatFactory $statFactory, \Magento\Framework\Lock\LockManagerInterface $lockManager) | |
execute (\Magento\Framework\Event\Observer $observer) | |
![]() | |
execute (Observer $observer) | |
Data Fields | |
const | CACHE_KEY_LAST_SCHEDULE_GENERATE_AT = 'cron_last_schedule_generate_at' |
const | CACHE_KEY_LAST_HISTORY_CLEANUP_AT = 'cron_last_history_cleanup_at' |
const | STANDALONE_PROCESS_STARTED = 'standaloneProcessStarted' |
const | XML_PATH_SCHEDULE_GENERATE_EVERY = 'schedule_generate_every' |
const | XML_PATH_SCHEDULE_AHEAD_FOR = 'schedule_ahead_for' |
const | XML_PATH_SCHEDULE_LIFETIME = 'schedule_lifetime' |
const | XML_PATH_HISTORY_CLEANUP_EVERY = 'history_cleanup_every' |
const | XML_PATH_HISTORY_SUCCESS = 'history_success_lifetime' |
const | XML_PATH_HISTORY_FAILURE = 'history_failure_lifetime' |
const | SECONDS_IN_MINUTE = 60 |
const | LOCK_TIMEOUT = 5 |
const | LOCK_PREFIX = 'CRON_GROUP_' |
Protected Member Functions | |
_runJob ($scheduledTime, $currentTime, $jobConfig, $schedule, $groupId) | |
_generateJobs ($jobs, $exists, $groupId) | |
getConfigSchedule ($jobConfig) | |
saveSchedule ($jobCode, $cronExpression, $timeInterval, $exists) | |
createSchedule ($jobCode, $cronExpression, $time) | |
getScheduleTimeInterval ($groupId) | |
Protected Attributes | |
$_pendingSchedules | |
$_config | |
$_objectManager | |
$_cache | |
$_scopeConfig | |
$_scheduleFactory | |
$_request | |
$_shell | |
$dateTime | |
$phpExecutableFinder | |
The observer for processing cron jobs.
@SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 24 of file ProcessCronQueueObserver.php.
__construct | ( | \Magento\Framework\ObjectManagerInterface | $objectManager, |
\Magento\Cron\Model\ScheduleFactory | $scheduleFactory, | ||
\Magento\Framework\App\CacheInterface | $cache, | ||
\Magento\Cron\Model\ConfigInterface | $config, | ||
\Magento\Framework\App\Config\ScopeConfigInterface | $scopeConfig, | ||
\Magento\Framework\App\Console\Request | $request, | ||
\Magento\Framework\ShellInterface | $shell, | ||
\Magento\Framework\Stdlib\DateTime\DateTime | $dateTime, | ||
\Magento\Framework\Process\PhpExecutableFinderFactory | $phpExecutableFinderFactory, | ||
\Psr\Log\LoggerInterface | $logger, | ||
\Magento\Framework\App\State | $state, | ||
StatFactory | $statFactory, | ||
\Magento\Framework\Lock\LockManagerInterface | $lockManager | ||
) |
\Magento\Framework\ObjectManagerInterface | $objectManager | |
\Magento\Cron\Model\ScheduleFactory | $scheduleFactory | |
\Magento\Framework\App\CacheInterface | $cache | |
\Magento\Cron\Model\ConfigInterface | $config | |
\Magento\Framework\App\Config\ScopeConfigInterface | $scopeConfig | |
\Magento\Framework\App\Console\Request | $request | |
\Magento\Framework\ShellInterface | $shell | |
\Magento\Framework\Stdlib\DateTime\DateTime | $dateTime | |
\Magento\Framework\Process\PhpExecutableFinderFactory | $phpExecutableFinderFactory | |
\Psr\Log\LoggerInterface | $logger | |
State | $state | |
StatFactory | $statFactory | |
\Magento\Framework\Lock\LockManagerInterface | $lockManager | @SuppressWarnings(PHPMD.ExcessiveParameterList) |
Definition at line 164 of file ProcessCronQueueObserver.php.
|
protected |
Generate jobs for config information
array | $jobs | |
array | $exists | |
string | $groupId |
Definition at line 455 of file ProcessCronQueueObserver.php.
|
protected |
Execute job by calling specific class::method
int | $scheduledTime | |
int | $currentTime | |
string[] | $jobConfig | |
Schedule | $schedule | |
string | $groupId |
Definition at line 289 of file ProcessCronQueueObserver.php.
|
protected |
Create a schedule of cron job.
string | $jobCode | |
string | $cronExpression | |
int | $time |
Definition at line 580 of file ProcessCronQueueObserver.php.
execute | ( | \Magento\Framework\Event\Observer | $observer | ) |
Process cron queue Generate tasks schedule Cleanup tasks schedule
\Magento\Framework\Event\Observer | $observer |
Definition at line 205 of file ProcessCronQueueObserver.php.
|
protected |
Get config of schedule.
array | $jobConfig |
Definition at line 528 of file ProcessCronQueueObserver.php.
|
protected |
Get time interval for scheduling.
string | $groupId |
Definition at line 598 of file ProcessCronQueueObserver.php.
|
protected |
Save a schedule of cron job.
string | $jobCode | |
string | $cronExpression | |
int | $timeInterval | |
array | $exists |
Definition at line 547 of file ProcessCronQueueObserver.php.
|
protected |
Definition at line 91 of file ProcessCronQueueObserver.php.
|
protected |
Definition at line 81 of file ProcessCronQueueObserver.php.
|
protected |
Definition at line 86 of file ProcessCronQueueObserver.php.
|
protected |
Definition at line 76 of file ProcessCronQueueObserver.php.
|
protected |
Definition at line 106 of file ProcessCronQueueObserver.php.
|
protected |
Definition at line 101 of file ProcessCronQueueObserver.php.
|
protected |
Definition at line 96 of file ProcessCronQueueObserver.php.
|
protected |
Definition at line 111 of file ProcessCronQueueObserver.php.
|
protected |
Definition at line 116 of file ProcessCronQueueObserver.php.
|
protected |
Definition at line 121 of file ProcessCronQueueObserver.php.
const CACHE_KEY_LAST_HISTORY_CLEANUP_AT = 'cron_last_history_cleanup_at' |
Definition at line 31 of file ProcessCronQueueObserver.php.
const CACHE_KEY_LAST_SCHEDULE_GENERATE_AT = 'cron_last_schedule_generate_at' |
#+ Cache key values
Definition at line 29 of file ProcessCronQueueObserver.php.
const LOCK_PREFIX = 'CRON_GROUP_' |
Static lock prefix for cron group locking
Definition at line 71 of file ProcessCronQueueObserver.php.
const LOCK_TIMEOUT = 5 |
How long to wait for cron group to become unlocked
Definition at line 66 of file ProcessCronQueueObserver.php.
const SECONDS_IN_MINUTE = 60 |
#- Value of seconds in one minute
Definition at line 61 of file ProcessCronQueueObserver.php.
const STANDALONE_PROCESS_STARTED = 'standaloneProcessStarted' |
Flag for internal communication between processes for running all jobs in a group in parallel as a separate process
Definition at line 37 of file ProcessCronQueueObserver.php.
const XML_PATH_HISTORY_CLEANUP_EVERY = 'history_cleanup_every' |
Definition at line 50 of file ProcessCronQueueObserver.php.
const XML_PATH_HISTORY_FAILURE = 'history_failure_lifetime' |
Definition at line 54 of file ProcessCronQueueObserver.php.
const XML_PATH_HISTORY_SUCCESS = 'history_success_lifetime' |
Definition at line 52 of file ProcessCronQueueObserver.php.
const XML_PATH_SCHEDULE_AHEAD_FOR = 'schedule_ahead_for' |
Definition at line 46 of file ProcessCronQueueObserver.php.
const XML_PATH_SCHEDULE_GENERATE_EVERY = 'schedule_generate_every' |
#- #+ List of configurable constants used to calculate and validate during handling cron jobs
Definition at line 44 of file ProcessCronQueueObserver.php.
const XML_PATH_SCHEDULE_LIFETIME = 'schedule_lifetime' |
Definition at line 48 of file ProcessCronQueueObserver.php.