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

daycry / jobs / 21145580946

19 Jan 2026 04:55PM UTC coverage: 58.025% (-4.5%) from 62.567%
21145580946

push

github

daycry
Add security, performance, and health features; simplify architecture

Introduces shell command whitelisting, smart token detection, per-queue rate limiting, dead letter queue, job timeout protection, config caching, and a health monitoring command. Refactors architecture by consolidating traits, removing the CompletionStrategy pattern, and unifying retry policies under RetryPolicyFixed. Updates documentation and tests to reflect new features and architectural changes, ensuring backward compatibility and improved reliability.

143 of 340 new or added lines in 20 files covered. (42.06%)

1 existing line in 1 file now uncovered.

1193 of 2056 relevant lines covered (58.03%)

4.44 hits per line

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

94.44
/src/Execution/RetryPolicyFixed.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of Daycry Queues.
7
 *
8
 * (c) Daycry <daycry9@proton.me>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace Daycry\Jobs\Execution;
15

16
use Throwable;
17

18
/**
19
 * Unified retry policy with configurable strategies: none, fixed, exponential.
20
 */
21
class RetryPolicyFixed implements RetryPolicy
22
{
23
    public function __construct(
24
        private int $base = 5,
25
        private string $strategy = 'fixed',
26
        private float $multiplier = 2.0,
27
        private int $max = 300,
28
        private bool $jitter = true,
29
    ) {
30
        $this->base       = max(0, $base);
21✔
31
        $this->multiplier = $multiplier > 0 ? $multiplier : 2.0;
21✔
32
        $this->max        = max(1, $max);
21✔
33
    }
34

35
    public function computeDelay(int $attempt): int
36
    {
37
        if ($attempt <= 1) {
9✔
38
            return 0;
2✔
39
        }
40

41
        return match ($this->strategy) {
9✔
42
            'exponential' => $this->computeExponential($attempt),
5✔
43
            'fixed'       => $this->base,
3✔
44
            default       => 0, // 'none'
9✔
45
        };
9✔
46
    }
47

48
    private function computeExponential(int $attempt): int
49
    {
50
        // attempt=2 => exponent 0
51
        $exponent = $attempt - 2;
5✔
52
        $delay    = (int) round($this->base * ($this->multiplier ** $exponent));
5✔
53
        $delay    = min($delay, $this->max);
5✔
54

55
        if ($this->jitter) {
5✔
56
            $range = max(1, (int) round($delay * 0.15));
2✔
57

58
            try {
59
                $delay = max(1, $delay + random_int(-$range, $range));
2✔
NEW
60
            } catch (Throwable) {
×
61
                // Fallback sin jitter
62
            }
63
        }
64

65
        return $delay;
5✔
66
    }
67
}
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