From 35d1ade3303c1eda4292366f8995d73f278be967 Mon Sep 17 00:00:00 2001 From: Stephen McMahon Date: Wed, 19 Jul 2017 10:27:51 +1000 Subject: [PATCH] Fix(defaultJobs) update readme and default jobs check to use injector correctly --- README.md | 49 +++++++++++++++--------------- code/services/QueuedJobService.php | 2 -- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index a887332b..69a19932 100644 --- a/README.md +++ b/README.md @@ -172,30 +172,31 @@ Default jobs are defined in yml config the sample below covers the options and e ``` Injector: QueuedJobService: - defaultJobs: - # This key is used as the title for error logs and alert emails - ArbitraryName: - # The job type should be the class name of a job REQUIRED - type: 'ScheduledExternalImportJob' - # This plus the job type is used to create the SQL query REQUIRED - filter: - # 1 or more Fieldname: 'value' sets that will be queried on REQUIRED - # These can be valid ORM filter - JobTitle: 'Scheduled import from Services' - # Sets whether the job will be recreated or not OPTIONAL - recreate: 1 - # Set the email address to send the alert to if not set site admin email is used OPTIONAL - email: 'admin@email.com' - # Parameters set on the recreated object OPTIONAL - construct: - # 1 or more Fieldname: 'value' sets be passed to the constructor OPTIONAL - repeat: 300 - title: 'Scheduled import from Services' - # Minimal implementation will send alerts but not recreate - AnotherTitle: - type: 'AJob' - filter: - JobTitle: 'A job' + properties: + defaultJobs: + # This key is used as the title for error logs and alert emails + ArbitraryName: + # The job type should be the class name of a job REQUIRED + type: 'ScheduledExternalImportJob' + # This plus the job type is used to create the SQL query REQUIRED + filter: + # 1 or more Fieldname: 'value' sets that will be queried on REQUIRED + # These can be valid ORM filter + JobTitle: 'Scheduled import from Services' + # Sets whether the job will be recreated or not OPTIONAL + recreate: 1 + # Set the email address to send the alert to if not set site admin email is used OPTIONAL + email: 'admin@email.com' + # Parameters set on the recreated object OPTIONAL + construct: + # 1 or more Fieldname: 'value' sets be passed to the constructor OPTIONAL + repeat: 300 + title: 'Scheduled import from Services' + # Minimal implementation will send alerts but not recreate + AnotherTitle: + type: 'AJob' + filter: + JobTitle: 'A job' ``` ## Configuring the CleanupJob diff --git a/code/services/QueuedJobService.php b/code/services/QueuedJobService.php index 1f54cf1a..04ae53b5 100644 --- a/code/services/QueuedJobService.php +++ b/code/services/QueuedJobService.php @@ -326,8 +326,6 @@ public function checkJobHealth($queue = null) { public function checkdefaultJobs($queue = null) { $queue = $queue ?: QueuedJob::QUEUED; - $this->defaultJobs = !empty($this->defaultJobs) ? $this->defaultJobs : Config::inst()->get(__CLASS__, 'defaultJobs'); - if (count($this->defaultJobs)) { $activeJobs = QueuedJobDescriptor::get()->filter(array(