PHP illuminate\queue Worker примеры использования

PHP illuminate\queue Worker - 3 примера найдено. Это лучшие примеры PHP кода для illuminate\queue\Worker, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Пример #1
0
 /**
  * Run the worker instance.
  *
  * @param  string  $connection
  * @param  string  $queue
  * @param  int  $delay
  * @param  int  $memory
  * @param  bool  $daemon
  * @return array
  */
 protected function runWorker($connection, $queue, $delay, $memory, $daemon = false)
 {
     if ($daemon) {
         $this->worker->setCache($this->laravel['cache']->driver());
         $this->worker->setDaemonExceptionHandler($this->laravel['Illuminate\\Contracts\\Debug\\ExceptionHandler']);
         return $this->worker->daemon($connection, $queue, $delay, $memory, $this->option('sleep'), $this->option('tries'));
     }
     return $this->worker->pop($connection, $queue, $delay, $this->option('sleep'), $this->option('tries'));
 }
 /**
  *  Process the job
  * 
  */
 protected function processJob($connectionName, $id)
 {
     $manager = $this->worker->getManager();
     $connection = $manager->connection($connectionName);
     $job = $connection->getJobFromId($id);
     // If we're able to pull a job off of the stack, we will process it and
     // then immediately return back out. If there is no job on the queue
     // we will "sleep" the worker for the specified number of seconds.
     if (!is_null($job)) {
         $sleep = max($job->getDatabaseJob()->available_at - time(), 0);
         sleep($sleep);
         return $this->worker->process($manager->getName($connectionName), $job);
     }
     return ['job' => null, 'failed' => false];
 }
Пример #3
0
 /**
  * Run the worker instance.
  *
  * @param  string  $connection
  * @param  string  $queue
  * @return array
  */
 protected function runWorker($connection, $queue)
 {
     $this->worker->setCache($this->laravel['cache']->driver());
     $method = $this->option('once') ? 'runNextJob' : 'daemon';
     return $this->worker->{$method}($connection, $queue, $this->gatherWorkerOptions());
 }