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

umbrellio / php-table-sync / 13572720694

27 Feb 2025 05:52PM CUT coverage: 42.714%. Remained the same
13572720694

Pull #26

github

web-flow
Merge 7c1dbd6bb into 3992b358b
Pull Request #26: Fix labeler (really)

299 of 700 relevant lines covered (42.71%)

23.77 hits per line

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

0.0
/src/Integration/Laravel/Console/Commands/WorkCommand.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Umbrellio\TableSync\Integration\Laravel\Console\Commands;
6

7
use Umbrellio\TableSync\Integration\Laravel\Console\ProcessManagerCommand;
8
use Umbrellio\TableSync\Rabbit\Consumer;
9

10
class WorkCommand extends ProcessManagerCommand
11
{
12
    protected $signature = 'table_sync:work';
13
    protected $description = 'Run table_sync worker';
14

15
    public function __destruct()
16
    {
17
        $this->pidManager->removePid();
×
18
    }
19

20
    public function handle(Consumer $consumer): void
21
    {
22
        if ($this->pidManager->pidExists()) {
×
23
            $this->warn("Table sync worker already running (PID: {$this->pidManager->readPid()})");
×
24
            return;
×
25
        }
26

27
        $this->pidManager->writePid();
×
28
        $this->listenTerminateSignals($consumer);
×
29

30
        $consumer->consume();
×
31
    }
32

33
    private function listenTerminateSignals(Consumer $consumer): void
34
    {
35
        pcntl_async_signals(true);
×
36

37
        pcntl_signal(SIGTERM, function () use ($consumer) {
×
38
            $this->line('Shutting down by SIGTERM.');
×
39

40
            $consumer->terminate();
×
41
        });
×
42

43
        pcntl_signal(SIGINT, function () use ($consumer) {
×
44
            $this->line('Shutting down by SIGINT');
×
45

46
            $consumer->terminate();
×
47
        });
×
48
    }
49
}
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

© 2025 Coveralls, Inc