• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tomasnorre / crawler / 17624430237

10 Sep 2025 07:17PM UTC coverage: 67.575% (-1.2%) from 68.768%
17624430237

Pull #1183

github

web-flow
Merge 8c98d5af1 into 96cae4d2b
Pull Request #1183: [TASK] Refactor ProcessCleanupHook, extract logic to ProcessManager and ProcessCleaner classes

4 of 55 new or added lines in 6 files covered. (7.27%)

17 existing lines in 1 file now uncovered.

1859 of 2751 relevant lines covered (67.58%)

3.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Classes/Process/Cleaner/OldProcessCleaner.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace AOE\Crawler\Process\Cleaner;
6

7
/*
8
 * (c) 2025 Tomas Norre Mikkelsen <tomasnorre@gmail.com>
9
 *
10
 * This file is part of the TYPO3 Crawler Extension.
11
 *
12
 * It is free software; you can redistribute it and/or modify it under
13
 * the terms of the GNU General Public License, either version 2
14
 * of the License, or any later version.
15
 *
16
 * For the full copyright and license information, please read the
17
 * LICENSE.txt file that was distributed with this source code.
18
 *
19
 * The TYPO3 project - inspiring people to share!
20
 */
21

22
use AOE\Crawler\Domain\Repository\ProcessRepository;
23
use AOE\Crawler\Domain\Repository\QueueRepository;
24
use AOE\Crawler\Process\ProcessManagerInterface;
25

26
class OldProcessCleaner
27
{
28
    public function __construct(
29
        private readonly ProcessRepository $processRepository,
30
        private readonly QueueRepository $queueRepository,
31
        private readonly ProcessManagerInterface $processManager
32
    ) {
NEW
33
    }
×
34

35
    public function clean(): void
36
    {
NEW
37
        $results = $this->processRepository->getActiveProcessesOlderThanOneHour();
×
38

NEW
39
        if (!is_array($results)) {
×
NEW
40
            return;
×
41
        }
42

NEW
43
        foreach ($results as $result) {
×
NEW
44
            $systemProcessId = (int) $result['system_process_id'];
×
NEW
45
            $processId = $result['process_id'];
×
46

NEW
47
            if ($systemProcessId <= 1) {
×
NEW
48
                continue;
×
49
            }
50

NEW
51
            if ($this->processManager->processExists($systemProcessId)) {
×
NEW
52
                $this->processManager->killProcess($systemProcessId);
×
53
            }
54

NEW
55
            $this->processRepository->removeByProcessId($processId);
×
NEW
56
            $this->queueRepository->unsetQueueProcessId($processId);
×
57
        }
58
    }
59
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc