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

LibreSign / libresign / 21017989272

15 Jan 2026 02:53AM UTC coverage: 44.43%. First build
21017989272

Pull #6436

github

web-flow
Merge 6ef45535a into db0316516
Pull Request #6436: feat: async parallel signing

415 of 962 new or added lines in 46 files covered. (43.14%)

7036 of 15836 relevant lines covered (44.43%)

4.94 hits per line

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

64.29
/lib/Service/Worker/WorkerCounter.php
1
<?php
2

3
declare(strict_types=1);
4
/**
5
 * SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8

9
namespace OCA\Libresign\Service\Worker;
10

11
use Psr\Log\LoggerInterface;
12

13
class WorkerCounter {
14
        public function __construct(
15
                private LoggerInterface $logger,
16
        ) {
17
        }
7✔
18

19
        public function countRunning(): int {
20
                try {
21
                        $cmd = $this->buildCountCommand();
1✔
22
                        $output = shell_exec($cmd);
1✔
23
                        return max(0, (int)trim((string)$output));
1✔
NEW
24
                } catch (\Throwable $e) {
×
NEW
25
                        $this->logger->debug('Failed to count running workers', [
×
NEW
26
                                'error' => $e->getMessage(),
×
NEW
27
                        ]);
×
NEW
28
                        return 0;
×
29
                }
30
        }
31

32
        private function buildCountCommand(): string {
33
                $occPath = \OC::$SERVERROOT . '/occ';
1✔
34
                return sprintf(
1✔
35
                        "ps -eo args | grep -F %s | grep -F 'background-job:worker' | grep -E 'SignFileJob|SignSingleFileJob' | grep -v grep | wc -l",
1✔
36
                        escapeshellarg($occPath)
1✔
37
                );
1✔
38
        }
39
}
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