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

daycry / jobs / 26886467550

03 Jun 2026 01:01PM UTC coverage: 88.948% (+14.0%) from 74.974%
26886467550

push

github

web-flow
v3.0: single clean architecture (remove V1, lease-based queues, secure-by-default)

Complete v3.0 rewrite into a single, clean architecture. The v1 API and the V2\ scaffolding
are removed (no facade, no dual code); the package passes PHPStan level 6 + strict-rules +
codeigniter with NO baseline.

- Definition: Jobs::define()->...->dispatch() fluent builder -> immutable JobDefinition.
- Handlers decoupled from the god-object (JobHandlerInterface / AbstractJobHandler / TypedJobHandler + JobContext).
- One QueueBackend contract (enqueue/fetch(lease)/ack/nack(delay)/abandon/reapExpired) with 5 backends:
  Sync, Database, Redis, Beanstalk, ServiceBus.
- Runtime: one attempt per fetch; real interrupting Timeout; opt-in idempotency; single-instance lock.
- Worker/Cron: jobs:queue:work, jobs:queue:reap, jobs:cronjob:run, jobs:queue:purge.
- Secure-by-default: HMAC-signed envelopes, per-queue handler allowlist, ShellHandler deny-by-default,
  EventHandler allowlist, UrlHandler anti-SSRF.

Resolves audit findings #1,#2,#3,#4,#5,#6,#7,#8,#10,#12,#13,#17,#18,#19,#20,#22.
Tests: 359 (Beanstalk live); line coverage 88.9%; PHPStan/Psalm/Rector/cs green on PHP 8.2-8.5.

BREAKING CHANGE: v1 API removed. See docs/MIGRATION-v1-to-v3.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

983 of 1103 new or added lines in 43 files covered. (89.12%)

15 existing lines in 3 files now uncovered.

1497 of 1683 relevant lines covered (88.95%)

7.55 hits per line

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

78.57
/src/Commands/QueueReapCommand.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\Commands;
15

16
use CodeIgniter\CLI\CLI;
17
use Daycry\Jobs\Queues\BackendFactory;
18

19
/**
20
 * Reclaims queue messages whose visibility timeout expired (crashed/stalled worker recovery).
21
 * Works for every v3 backend via QueueBackend::reapExpired(). Intended to run periodically
22
 * (e.g. once per minute from system cron) so jobs left 'in_progress' do not strand.
23
 */
24
final class QueueReapCommand extends BaseJobsCommand
25
{
26
    protected $name        = 'jobs:queue:reap';
27
    protected $description = 'Reclaim queue messages whose visibility timeout expired.';
28
    protected $usage       = 'jobs:queue:reap [queue] [--backend name]';
29
    protected $arguments   = ['queue' => 'The queue name to reap.'];
30
    protected $options     = ['--backend' => 'Override the configured backend name.'];
31

32
    /**
33
     * @param array<int|string, string|null> $params
34
     */
35
    public function run(array $params): int
36
    {
37
        $this->getConfig();
1✔
38

39
        $queue = $params['queue'] ?? $params[0] ?? CLI::getOption('queue');
1✔
40
        if (! is_string($queue) || $queue === '') {
1✔
NEW
41
            CLI::error('A queue name is required: jobs:queue:reap <queue>');
×
42

NEW
43
            return self::FAILURE;
×
44
        }
45

46
        $backendOption = $params['backend'] ?? CLI::getOption('backend');
1✔
47
        $name          = is_string($backendOption) && $backendOption !== '' ? $backendOption : $this->config->worker;
1✔
48

49
        $backend = BackendFactory::make($this->config, $name);
1✔
50
        $timeout = $name === 'redis'
1✔
NEW
51
            ? $this->config->redisProcessingVisibilityTimeout
×
52
            : $this->config->databaseVisibilityTimeout;
1✔
53

54
        $reaped = $backend->reapExpired($queue, $timeout);
1✔
55
        CLI::write("Reaped {$reaped} expired message(s) from queue '{$queue}'.", 'green');
1✔
56

57
        return self::SUCCESS;
1✔
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