17
17
use Magento \Framework \Profiler \Driver \Standard \StatFactory ;
18
18
19
19
/**
20
+ * The observer for processing cron jobs.
21
+ *
20
22
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
21
23
*/
22
24
class ProcessCronQueueObserver implements ObserverInterface
@@ -154,8 +156,9 @@ class ProcessCronQueueObserver implements ObserverInterface
154
156
* @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
155
157
* @param \Magento\Framework\Process\PhpExecutableFinderFactory $phpExecutableFinderFactory
156
158
* @param \Psr\Log\LoggerInterface $logger
157
- * @param \Magento\Framework\App\ State $state
159
+ * @param State $state
158
160
* @param StatFactory $statFactory
161
+ * @param \Magento\Framework\Lock\LockManagerInterface $lockManager
159
162
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
160
163
*/
161
164
public function __construct (
@@ -378,8 +381,9 @@ private function getProfilingStat()
378
381
}
379
382
380
383
/**
381
- * Return job collection from data base with status 'pending'
384
+ * Return job collection from data base with status 'pending'.
382
385
*
386
+ * @param string $groupId
383
387
* @return \Magento\Cron\Model\ResourceModel\Schedule\Collection
384
388
*/
385
389
private function getPendingSchedules ($ groupId )
@@ -464,8 +468,8 @@ protected function _generateJobs($jobs, $exists, $groupId)
464
468
/**
465
469
* Clean expired jobs
466
470
*
467
- * @param $groupId
468
- * @param $currentTime
471
+ * @param string $groupId
472
+ * @param int $currentTime
469
473
* @return void
470
474
*/
471
475
private function cleanupJobs ($ groupId , $ currentTime )
@@ -516,6 +520,8 @@ private function cleanupJobs($groupId, $currentTime)
516
520
}
517
521
518
522
/**
523
+ * Get config of schedule.
524
+ *
519
525
* @param array $jobConfig
520
526
* @return mixed
521
527
*/
@@ -530,6 +536,8 @@ protected function getConfigSchedule($jobConfig)
530
536
}
531
537
532
538
/**
539
+ * Save a schedule of cron job.
540
+ *
533
541
* @param string $jobCode
534
542
* @param string $cronExpression
535
543
* @param int $timeInterval
@@ -562,6 +570,8 @@ protected function saveSchedule($jobCode, $cronExpression, $timeInterval, $exist
562
570
}
563
571
564
572
/**
573
+ * Create a schedule of cron job.
574
+ *
565
575
* @param string $jobCode
566
576
* @param string $cronExpression
567
577
* @param int $time
@@ -580,6 +590,8 @@ protected function createSchedule($jobCode, $cronExpression, $time)
580
590
}
581
591
582
592
/**
593
+ * Get time interval for scheduling.
594
+ *
583
595
* @param string $groupId
584
596
* @return int
585
597
*/
@@ -592,8 +604,9 @@ protected function getScheduleTimeInterval($groupId)
592
604
}
593
605
594
606
/**
595
- * Clean up scheduled jobs that are disabled in the configuration
596
- * This can happen when you turn off a cron job in the config and flush the cache
607
+ * Clean up scheduled jobs that are disabled in the configuration.
608
+ *
609
+ * This can happen when you turn off a cron job in the config and flush the cache.
597
610
*
598
611
* @param string $groupId
599
612
* @return void
@@ -624,6 +637,8 @@ private function cleanupDisabledJobs($groupId)
624
637
}
625
638
626
639
/**
640
+ * Get cron expression of cron job.
641
+ *
627
642
* @param array $jobConfig
628
643
* @return null|string
629
644
*/
@@ -643,8 +658,9 @@ private function getCronExpression($jobConfig)
643
658
}
644
659
645
660
/**
646
- * Clean up scheduled jobs that do not match their cron expression anymore
647
- * This can happen when you change the cron expression and flush the cache
661
+ * Clean up scheduled jobs that do not match their cron expression anymore.
662
+ *
663
+ * This can happen when you change the cron expression and flush the cache.
648
664
*
649
665
* @return $this
650
666
*/
@@ -663,9 +679,10 @@ private function cleanupScheduleMismatches()
663
679
}
664
680
665
681
/**
666
- * Get CronGroup Configuration Value
682
+ * Get CronGroup Configuration Value.
667
683
*
668
- * @param $groupId
684
+ * @param string $groupId
685
+ * @param string $path
669
686
* @return int
670
687
*/
671
688
private function getCronGroupConfigurationValue ($ groupId , $ path )
@@ -677,9 +694,9 @@ private function getCronGroupConfigurationValue($groupId, $path)
677
694
}
678
695
679
696
/**
680
- * Is Group In Filter
697
+ * Is Group In Filter.
681
698
*
682
- * @param $groupId
699
+ * @param string $groupId
683
700
* @return bool
684
701
*/
685
702
private function isGroupInFilter ($ groupId ): bool
@@ -689,11 +706,11 @@ private function isGroupInFilter($groupId): bool
689
706
}
690
707
691
708
/**
692
- * Process pending jobs
709
+ * Process pending jobs.
693
710
*
694
- * @param $groupId
695
- * @param $jobsRoot
696
- * @param $currentTime
711
+ * @param string $groupId
712
+ * @param array $jobsRoot
713
+ * @param int $currentTime
697
714
*/
698
715
private function processPendingJobs ($ groupId , $ jobsRoot , $ currentTime )
699
716
{
@@ -730,6 +747,8 @@ private function processPendingJobs($groupId, $jobsRoot, $currentTime)
730
747
}
731
748
732
749
/**
750
+ * Process error messages.
751
+ *
733
752
* @param Schedule $schedule
734
753
* @param \Exception $exception
735
754
* @return void
0 commit comments