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

tochka-developers / queue-promises / 5133778705

pending completion
5133778705

push

github

darkdarin
fix: set next watch time at timeout_at for correct timeout promises

669 of 1021 relevant lines covered (65.52%)

2.33 hits per line

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

0.0
/src/Core/Support/DaemonWithSignals.php
1
<?php
2

3
namespace Tochka\Promises\Core\Support;
4

5
trait DaemonWithSignals
6
{
7
    private bool $shouldQuit = false;
8
    private bool $paused = false;
9

10
    /**
11
     * Enable async signals for the process.
12
     *
13
     * @return void
14
     */
15
    protected function listenForSignals(): void
16
    {
17
        pcntl_async_signals(true);
×
18

19
        pcntl_signal(SIGTERM, function () {
×
20
            echo 'GC daemon is terminating...' . PHP_EOL;
×
21
            $this->shouldQuit = true;
×
22
        });
×
23

24
        pcntl_signal(SIGUSR2, function () {
×
25
            echo 'GC daemon is paused...' . PHP_EOL;
×
26
            $this->paused = true;
×
27
        });
×
28

29
        pcntl_signal(SIGCONT, function () {
×
30
            echo 'GC daemon continued execution' . PHP_EOL;
×
31
            $this->paused = false;
×
32
        });
×
33
    }
34

35
    /**
36
     * Determine if "async" signals are supported.
37
     *
38
     * @return bool
39
     */
40
    protected function supportsAsyncSignals(): bool
41
    {
42
        return extension_loaded('pcntl');
×
43
    }
44

45
    protected function shouldQuit(): bool
46
    {
47
        return $this->shouldQuit;
×
48
    }
49

50
    protected function paused(): bool
51
    {
52
        return $this->paused;
×
53
    }
54
}
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