From 5da00e616312f19a99b32eca1586a11f6309168e Mon Sep 17 00:00:00 2001 From: Michael van Schaik Date: Sat, 1 Apr 2017 06:47:03 +0200 Subject: [PATCH 1/3] Making inclusion-duration of finished jobs configurable --- code/controllers/QueuedJobsAdmin.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/controllers/QueuedJobsAdmin.php b/code/controllers/QueuedJobsAdmin.php index dba636a8..849f1e98 100644 --- a/code/controllers/QueuedJobsAdmin.php +++ b/code/controllers/QueuedJobsAdmin.php @@ -48,6 +48,12 @@ class QueuedJobsAdmin extends ModelAdmin { * @var QueuedJobService */ public $jobQueue; + + /** + * @config The number of seconds to include jobs that have finished + * default: 300 (5 minutes), examples: 3600(1h), 86400(1d) + */ + private static $max_finished_jobs_age = 300; /** * @param int $id @@ -57,7 +63,7 @@ class QueuedJobsAdmin extends ModelAdmin { public function getEditForm($id = null, $fields = null) { $form = parent::getEditForm($id, $fields); - $filter = $this->jobQueue->getJobListFilter(null, 300); + $filter = $this->jobQueue->getJobListFilter(null, self::config()->max_finished_jobs_age); $list = DataList::create('QueuedJobDescriptor'); $list = $list->where($filter)->sort('Created', 'DESC'); From a98e02f38d518c9d21c2bc118cb20b4c1bf86225 Mon Sep 17 00:00:00 2001 From: Nathan Glasl Date: Fri, 30 Jun 2017 18:17:03 +1000 Subject: [PATCH 2/3] FIX, correcting an issue where the module would end up on the wrong path. --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8adb9a35..bc5886cb 100644 --- a/composer.json +++ b/composer.json @@ -19,5 +19,8 @@ "silverstripe/framework": "~3.1", "silverstripe/multivaluefield": "~2.0", "asyncphp/doorman": "~1.2" - } + }, + "extra": { + "installer-name": "queuedjobs" + } } From 087c8ca1ac10b2b0b38810417e6880d1e671f26d Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Thu, 2 Nov 2017 14:54:08 +0000 Subject: [PATCH 3/3] FIX ImmediateQueueHandler needs `scheduleJob` method to match expected API --- code/services/ImmediateQueueHandler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/services/ImmediateQueueHandler.php b/code/services/ImmediateQueueHandler.php index 572e6541..2961c2af 100644 --- a/code/services/ImmediateQueueHandler.php +++ b/code/services/ImmediateQueueHandler.php @@ -25,4 +25,8 @@ class ImmediateQueueHandler { public function startJobOnQueue(QueuedJobDescriptor $job) { $this->queuedJobService->runJob($job->ID); } + + public function scheduleJob(QueuedJobDescriptor $job, $date) { + $this->queuedJobService->runJob($job->ID); + } }