Skip to content

Commit 7bc5cd5

Browse files
committed
Update DefaultWorker to support the latest Laravel versions by default (potential >L12.x)
1 parent 5798312 commit 7bc5cd5

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/Wrappers/DefaultWorker.php

+18-2
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,33 @@
33
namespace Dusterio\AwsWorker\Wrappers;
44

55
use Illuminate\Queue\Worker;
6+
use Illuminate\Queue\WorkerOptions;
7+
use Illuminate\Contracts\Cache\Repository as Cache;
68

79
/**
810
* Class DefaultWorker
911
* @package Dusterio\AwsWorker\Wrappers
1012
*/
1113
class DefaultWorker implements WorkerInterface
1214
{
15+
/**
16+
* @var Worker
17+
*/
18+
public $worker;
19+
20+
/**
21+
* @var Cache
22+
*/
23+
public $cache;
24+
1325
/**
1426
* DefaultWorker constructor.
1527
* @param Worker $worker
28+
* @param \Illuminate\Contracts\Cache\Repository $cache
1629
*/
17-
public function __construct(Worker $worker)
30+
public function __construct(Worker $worker, Cache $cache)
1831
{
32+
$this->cache = $cache;
1933
$this->worker = $worker;
2034
}
2135

@@ -27,8 +41,10 @@ public function __construct(Worker $worker)
2741
*/
2842
public function process($queue, $job, array $options)
2943
{
44+
$workerOptions = new WorkerOptions('default', $options['delay'], 128, $options['timeout'], 3, $options['maxTries']);
45+
3046
$this->worker->process(
31-
$queue, $job, $options['maxTries'], $options['delay']
47+
$queue, $job, $workerOptions
3248
);
3349
}
3450
}

0 commit comments

Comments
 (0)