From 04d2bd69c1a527604ced45e3dbbcdc17155d9178 Mon Sep 17 00:00:00 2001 From: yuri Date: Fri, 29 Apr 2016 16:40:05 +0300 Subject: [PATCH] fix jobs --- application/Espo/Core/CronManager.php | 5 ++++- application/Espo/Core/Utils/Cron/Job.php | 14 +++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/application/Espo/Core/CronManager.php b/application/Espo/Core/CronManager.php index b023136ed5..ac5d571f12 100644 --- a/application/Espo/Core/CronManager.php +++ b/application/Espo/Core/CronManager.php @@ -154,8 +154,11 @@ class CronManager } $this->setLastRunTime(time()); + + $this->getCronJob()->markFailedJobs(); + $this->getCronJob()->updateFailedJobAttempts(); $this->createJobsFromScheduledJobs(); - $this->getCronJob()->handleExistingJobs(); + $this->getCronJob()->removePendingJobDuplicates(); $pendingJobList = $this->getCronJob()->getPendingJobList(); diff --git a/application/Espo/Core/Utils/Cron/Job.php b/application/Espo/Core/Utils/Cron/Job.php index a361a7b074..6389e0675f 100644 --- a/application/Espo/Core/Utils/Cron/Job.php +++ b/application/Espo/Core/Utils/Cron/Job.php @@ -64,14 +64,6 @@ class Job return $this->cronScheduledJob; } - - public function handleExistingJobs() - { - $this->markFailedJobs(); - $this->markJobAttempts(); - $this->removePendingJobDuplicates(); - } - /** * Get Pending Jobs * @@ -194,7 +186,7 @@ class Job * * @return void */ - protected function markFailedJobs() + public function markFailedJobs() { $jobConfigs = $this->getConfig()->get('cron'); @@ -238,7 +230,7 @@ class Job * * @return void */ - protected function removePendingJobDuplicates() + public function removePendingJobDuplicates() { $pdo = $this->getEntityManager()->getPDO(); @@ -294,7 +286,7 @@ class Job * * @return void */ - protected function markJobAttempts() + public function updateFailedJobAttempts() { $query = " SELECT * FROM job