mirror of
https://github.com/idanoo/laravel-resque.git
synced 2025-07-05 04:32:13 +00:00
improvements to config
This commit is contained in:
parent
b60fb0d712
commit
afceda3d95
3 changed files with 137 additions and 15 deletions
|
@ -2,6 +2,7 @@
|
|||
namespace Hlgrrnhrdt\Resque;
|
||||
|
||||
use Resque;
|
||||
use Resque_Worker;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
|
@ -12,13 +13,25 @@ use RuntimeException;
|
|||
class ResqueManager
|
||||
{
|
||||
/**
|
||||
* @var PhpResque
|
||||
* @var Resque
|
||||
*/
|
||||
private $resque;
|
||||
protected $resque;
|
||||
|
||||
public function __construct(Resque $resque)
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $trackStatus = false;
|
||||
|
||||
/**
|
||||
* ResqueManager constructor.
|
||||
*
|
||||
* @param \Resque $resque
|
||||
* @param bool $trackStatus
|
||||
*/
|
||||
public function __construct(Resque $resque, $trackStatus = false)
|
||||
{
|
||||
$this->resque = $resque;
|
||||
$this->trackStatus = $trackStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,4 +98,20 @@ class ResqueManager
|
|||
|
||||
return $pid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $queues
|
||||
* @param int $interval
|
||||
* @param int $logLevel
|
||||
*
|
||||
* @return \Resque_Worker
|
||||
*/
|
||||
public function startWorker(array $queues, $interval = 5, $logLevel = Resque_Worker::LOG_NONE)
|
||||
{
|
||||
$worker = new Resque_Worker($queues);
|
||||
$worker->logLevel = $logLevel;
|
||||
$worker->work($interval);
|
||||
|
||||
return $worker;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue