Skip to content

Commit

Permalink
Merge pull request #136 from stephenmcm/fix-defaultjob
Browse files Browse the repository at this point in the history
Fix(defaultJobs) fix filtering of active jobs. Improve log messages
  • Loading branch information
stephenmcm authored Jul 20, 2017
2 parents 6e7bd17 + 4103227 commit 1e9f26a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions code/services/QueuedJobService.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,16 +328,15 @@ public function checkdefaultJobs($queue = null) {

if (count($this->defaultJobs)) {

$activeJobs = QueuedJobDescriptor::get()->filter(array(
'JobStatus' => array(
$activeJobs = QueuedJobDescriptor::get()->filter(
'JobStatus', array(
QueuedJob::STATUS_NEW,
QueuedJob::STATUS_INIT,
QueuedJob::STATUS_RUN,
QueuedJob::STATUS_WAIT,
QueuedJob::STATUS_PAUSED
),
'JobType' => $queue
));
)
);

foreach ($this->defaultJobs as $title => $jobConfig) {
if (!isset($jobConfig['filter']) || !isset($jobConfig['type'])) {
Expand All @@ -350,7 +349,7 @@ public function checkdefaultJobs($queue = null) {
));

if (!$job->count()) {
SS_Log::log("Default Job config: $title was missing from Queue and has been re-added", SS_Log::ERR);
SS_Log::log("Default Job config: $title was missing from Queue", SS_Log::ERR);
Email::create()
->setTo(isset($jobConfig['email']) ? $jobConfig['email'] : Config::inst()->get('Email', 'queued_job_admin_email'))
->setFrom(Config::inst()->get('Email', 'queued_job_admin_email'))
Expand All @@ -369,6 +368,7 @@ public function checkdefaultJobs($queue = null) {
Injector::inst()->createWithArgs($jobConfig['type'], $jobConfig['construct']),
date($jobConfig['startDateFormat'], strtotime($jobConfig['startTimeString']))
);
SS_Log::log("Default Job config: $title has been re-added to the Queue", SS_Log::ERR);
}
}
}
Expand Down

0 comments on commit 1e9f26a

Please sign in to comment.