From a99b84bb8689d5495c4f25cfa976bb0ba909ac8d Mon Sep 17 00:00:00 2001 From: yuri Date: Fri, 30 Nov 2018 11:59:54 +0200 Subject: [PATCH] job number --- application/Espo/Core/CronManager.php | 10 ---------- application/Espo/Core/Utils/Cron/Job.php | 6 ++---- application/Espo/Jobs/Cleanup.php | 2 +- application/Espo/Resources/i18n/en_US/Job.json | 3 ++- .../Espo/Resources/layouts/Job/detailSmall.json | 2 +- .../Espo/Resources/metadata/entityDefs/Job.json | 12 ++++++------ 6 files changed, 12 insertions(+), 23 deletions(-) diff --git a/application/Espo/Core/CronManager.php b/application/Espo/Core/CronManager.php index be7007d63a..e660c87827 100644 --- a/application/Espo/Core/CronManager.php +++ b/application/Espo/Core/CronManager.php @@ -367,12 +367,6 @@ class CronManager $methodNameDeprecated = $job->get('method'); $methodName = $job->get('methodName'); - $isDeprecated = false; - if (!$methodName) { - $isDeprecated = true; - $methodName = $methodNameDeprecated; - } - if (!$methodName) { throw new Error('Job with empty methodName.'); } @@ -383,10 +377,6 @@ class CronManager $data = $job->get('data'); - if ($isDeprecated) { - $data = Json::decode(Json::encode($data), true); - } - $service->$methodName($data, $job->get('targetId'), $job->get('targetType')); } diff --git a/application/Espo/Core/Utils/Cron/Job.php b/application/Espo/Core/Utils/Cron/Job.php index 77284c6c05..cd4e017da2 100644 --- a/application/Espo/Core/Utils/Cron/Job.php +++ b/application/Espo/Core/Utils/Cron/Job.php @@ -85,17 +85,15 @@ class Job 'targetId', 'targetType', 'methodName', - 'method', // TODO remove deprecated 'serviceName', - 'data', - 'queue' + 'data' ], 'whereClause' => [ 'status' => CronManager::PENDING, 'executeTime<=' => date('Y-m-d H:i:s'), 'queue' => $queue ], - 'orderBy' => 'executeTime' + 'orderBy' => 'number' ]; if ($limit) { $selectParams['offset'] = 0; diff --git a/application/Espo/Jobs/Cleanup.php b/application/Espo/Jobs/Cleanup.php index 0d9a4ecb34..db726e8f87 100644 --- a/application/Espo/Jobs/Cleanup.php +++ b/application/Espo/Jobs/Cleanup.php @@ -33,7 +33,7 @@ use \Espo\Core\Exceptions; class Cleanup extends \Espo\Core\Jobs\Base { - protected $cleanupJobPeriod = '1 month'; + protected $cleanupJobPeriod = '10 days'; protected $cleanupActionHistoryPeriod = '15 days'; diff --git a/application/Espo/Resources/i18n/en_US/Job.json b/application/Espo/Resources/i18n/en_US/Job.json index 3b84d0d2ef..91bfd7a416 100644 --- a/application/Espo/Resources/i18n/en_US/Job.json +++ b/application/Espo/Resources/i18n/en_US/Job.json @@ -13,6 +13,7 @@ "data": "Data", "targetType": "Target Type", "targetId": "Target ID", + "number": "Number", "queue": "Queue" }, "options": { @@ -23,4 +24,4 @@ "Failed": "Failed" } } -} \ No newline at end of file +} diff --git a/application/Espo/Resources/layouts/Job/detailSmall.json b/application/Espo/Resources/layouts/Job/detailSmall.json index 9a2a5c8edd..f7af4dc883 100644 --- a/application/Espo/Resources/layouts/Job/detailSmall.json +++ b/application/Espo/Resources/layouts/Job/detailSmall.json @@ -3,7 +3,7 @@ "label":"", "rows":[ [{"name":"name"}, {"name": "status"}], - [{"name":"queue"}, false] + [{"name":"queue"}, {"name":"number"}] ] }, { diff --git a/application/Espo/Resources/metadata/entityDefs/Job.json b/application/Espo/Resources/metadata/entityDefs/Job.json index d96990f084..46078fcd1e 100644 --- a/application/Espo/Resources/metadata/entityDefs/Job.json +++ b/application/Espo/Resources/metadata/entityDefs/Job.json @@ -20,16 +20,16 @@ "type": "datetime", "required": true }, + "number": { + "type": "autoincrement", + "index": true, + "dbType": "bigint" + }, "serviceName": { "type": "varchar", "required": true, "maxLength": 100 }, - "method": { - "type": "varchar", - "required": true, - "maxLength":100 - }, "methodName": { "type": "varchar", "maxLength": 100 @@ -86,7 +86,7 @@ } }, "collection": { - "orderBy": "createdAt", + "orderBy": "number", "order": "desc", "textFilterFields": ["name", "methodName", "serviceName", "scheduledJobName"] },