|
4 | 4 |
|
5 | 5 | namespace SFC\Staticfilecache\Controller; |
6 | 6 |
|
| 7 | +use Doctrine\DBAL\Exception; |
7 | 8 | use Psr\Log\LoggerAwareInterface; |
8 | 9 | use Psr\Log\LoggerAwareTrait; |
9 | 10 | use SFC\Staticfilecache\Cache\UriFrontend; |
@@ -50,26 +51,42 @@ public function listAction(string $filter = ''): ResponseInterface |
50 | 51 | ->renderResponse('Backend/List'); |
51 | 52 | } |
52 | 53 |
|
| 54 | + /** |
| 55 | + * @throws Exception |
| 56 | + */ |
53 | 57 | public function boostAction(bool $run = false): ResponseInterface |
54 | 58 | { |
55 | 59 | $queueRepository = GeneralUtility::makeInstance(QueueRepository::class); |
56 | 60 | if ($run) { |
57 | 61 | $items = $queueRepository->findOpen(10); |
| 62 | + $processedCount = 0; |
58 | 63 |
|
59 | 64 | try { |
60 | 65 | foreach ($items as $item) { |
61 | 66 | $this->queueService->runSingleRequest($item); |
| 67 | + $processedCount++; |
62 | 68 | } |
63 | | - } catch (\Exception $exception) { |
| 69 | + } catch (\Throwable $exception) { |
64 | 70 | $this->addFlashMessage('Error in run: ' . $exception->getMessage(), 'Runner', ContextualFeedbackSeverity::ERROR, true); |
65 | 71 | } |
66 | 72 |
|
67 | | - $this->addFlashMessage('Run ' . \count($items) . ' entries', 'Runner', ContextualFeedbackSeverity::OK, true); |
| 73 | + $this->addFlashMessage('Run ' . $processedCount . ' entries', 'Runner', ContextualFeedbackSeverity::OK, true); |
| 74 | + } |
| 75 | + |
| 76 | + $openCount = 0; |
| 77 | + foreach ($queueRepository->findOpen(99999999) as $ignored) { |
| 78 | + $openCount++; |
68 | 79 | } |
| 80 | + |
| 81 | + $oldCount = 0; |
| 82 | + foreach ($queueRepository->findOldUids() as $ignored1) { |
| 83 | + $oldCount++; |
| 84 | + } |
| 85 | + |
69 | 86 | $viewVariables = [ |
70 | 87 | 'enable' => (bool) $this->configurationService->get('boostMode'), |
71 | | - 'open' => \count(iterator_to_array($queueRepository->findOpen(99999999))), |
72 | | - 'old' => \count(iterator_to_array($queueRepository->findOldUids())), |
| 88 | + 'open' => $openCount, |
| 89 | + 'old' => $oldCount, |
73 | 90 | ]; |
74 | 91 |
|
75 | 92 | return $this->createModuleTemplate() |
|
0 commit comments