Example #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['exception']);
         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'));
 }
Example #2
0
 /**
  * Set the options on the queue listener.
  *
  * @return void
  */
 protected function setListenerOptions()
 {
     $this->listener->setEnvironment($this->laravel->environment());
     $this->listener->setSleep($this->option('sleep'));
     $this->listener->setMaxTries($this->option('tries'));
     $this->listener->setOutputHandler(function ($type, $line) {
         $this->output->write($line);
     });
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $delay = $this->input->getOption('delay');
     // The memory limit is the amount of memory we will allow the script to occupy
     // before killing it and letting a process manager restart it for us, which
     // is to protect us against any memory leaks that will be in the scripts.
     $memory = $this->input->getOption('memory');
     $connection = $this->input->getArgument('connection');
     $this->listener->listen($connection, $this->getQueue(), $delay, $memory);
 }
Example #4
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $queue = $this->option('queue');
     $delay = $this->option('delay');
     // The memory limit is the amount of memory we will allow the script to occupy
     // before killing it and letting a process manager restart it for us, which
     // is to protect us against any memory leaks that will be in the scripts.
     $memory = $this->option('memory');
     $connection = $this->argument('connection');
     $this->worker->pop($connection, $queue, $delay, $memory, $this->option('sleep'));
 }
Example #5
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->listener->setEnvironment($this->laravel->environment());
     $delay = $this->input->getOption('delay');
     // The memory limit is the amount of memory we will allow the script to occupy
     // before killing it and letting a process manager restart it for us, which
     // is to protect us against any memory leaks that will be in the scripts.
     $memory = $this->input->getOption('memory');
     $connection = $this->input->getArgument('connection');
     $timeout = $this->input->getOption('timeout');
     // We need to get the right queue for the connection which is set in the queue
     // configuration file for the application. We will pull it based on the set
     // connection being run for the queue operation currently being executed.
     $queue = $this->getQueue($connection);
     $this->listener->listen($connection, $queue, $delay, $memory, $timeout);
 }
Example #6
0
 /**
  * Build the environment specific worker command.
  *
  * @return string
  */
 protected function buildWorkerCommand()
 {
     if (!app()->isRunningOnGae()) {
         return parent::buildWorkerCommand();
     }
     $binary = (new PhpExecutableFinder())->find(false);
     if (defined('HHVM_VERSION')) {
         $binary .= ' --php';
     }
     if (defined('ARTISAN_BINARY')) {
         $artisan = ARTISAN_BINARY;
     } else {
         $artisan = 'artisan';
     }
     $command = 'queue:work %s --queue=%s --delay=%s --memory=%s --sleep=%s --tries=%s';
     return "{$binary} {$artisan} {$command}";
 }
Example #7
0
 /**
  * Set the options on the queue listener.
  *
  * @return void
  */
 protected function setListenerOptions()
 {
     $this->listener->setEnvironment($this->laravel->environment());
     $this->listener->setSleep($this->option('sleep'));
 }