mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
PHRAS-3995: Admin - worker - job queue - average duration (#4448)
* add average duration * fix * fix duration
This commit is contained in:
@@ -141,9 +141,12 @@ class AdminConfigurationController extends Controller
|
||||
$helpers = new PhraseanetExtension($this->app);
|
||||
|
||||
$workerRunningJob = $repoWorker->findByFilter($filterStatus, $jobType, $databoxId, $recordId, $fieldTimeFilter, $dateTimeFilter);
|
||||
$workerRunningJobTotalCount = $repoWorker->getJobCount($filterStatus, $jobType, $databoxId, $recordId);
|
||||
$workerRunningJobTotalCount = $repoWorker->getJobCount($filterStatus, $jobType, $databoxId, $recordId, $fieldTimeFilter, $dateTimeFilter);
|
||||
$workerRunningJobTotalCount = number_format($workerRunningJobTotalCount, 0, '.', ' ');
|
||||
$totalDuration = array_sum(array_column($workerRunningJob, 'duration'));
|
||||
|
||||
$averageDuration = (count($workerRunningJob) == 0) ? 0 : $totalDuration/(float)count($workerRunningJob);
|
||||
|
||||
// format duration
|
||||
$totalDuration = $helpers->getDuration($totalDuration);
|
||||
|
||||
@@ -159,7 +162,7 @@ class AdminConfigurationController extends Controller
|
||||
$realEntryDuration = $helpers->getDuration($realEntryDuration);
|
||||
|
||||
// get all row count in the table WorkerRunningJob
|
||||
$totalCount = $repoWorker->getJobCount([], null, null , null);
|
||||
$totalCount = $repoWorker->getJobCount([], null, null , null, null, null);
|
||||
$totalCount = number_format($totalCount, 0, '.', ' ');
|
||||
|
||||
$databoxIds = array_map(function (\databox $databox) {
|
||||
@@ -186,6 +189,7 @@ class AdminConfigurationController extends Controller
|
||||
'resultTotal' => $workerRunningJobTotalCount,
|
||||
'totalCount' => $totalCount,
|
||||
'totalDuration' => $totalDuration,
|
||||
'averageDuration' => number_format($averageDuration, 2, '.', ' ') . ' s',
|
||||
'realEntryDuration'=> $realEntryDuration
|
||||
]);
|
||||
} else {
|
||||
@@ -198,6 +202,7 @@ class AdminConfigurationController extends Controller
|
||||
'resultTotal' => $workerRunningJobTotalCount,
|
||||
'totalCount' => $totalCount,
|
||||
'totalDuration' => $totalDuration,
|
||||
'averageDuration' => number_format($averageDuration, 2, '.', ' ') . ' s',
|
||||
'realEntryDuration'=> $realEntryDuration
|
||||
]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user