Skip to content

Commit

Permalink
STRAT-3683: handle case when cron schedule table was cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbojanowski committed Mar 15, 2021
1 parent d3b4733 commit 2c15b73
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Model/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,10 @@ function setJobStatus($scheduleid,$status,$output) {
* @return array
*/
function getJob($scheduleid) {
return $this->pendingjobs[$scheduleid];
if (isset($this->pendingjobs[$scheduleid])) {
return $this->pendingjobs[$scheduleid];
}
return NULL;
}

/**
Expand Down Expand Up @@ -515,10 +518,12 @@ public function service() {

if ($this->governor) {
$job = $this->getJob($scheduleid);
$jobconfig = $this->getJobConfig($job["job_code"]);
if (isset($jobconfig["consumers"]) && $jobconfig["consumers"]) {
#run the consumers governor
$this->consumersGovenor($pid,$scheduleid);
if ($job) {
$jobconfig = $this->getJobConfig($job["job_code"]);
if (isset($jobconfig["consumers"]) && $jobconfig["consumers"]) {
#run the consumers governor
$this->consumersGovenor($pid, $scheduleid);
}
}
}

Expand Down

0 comments on commit 2c15b73

Please sign in to comment.