sleep() public method

Sleep the script for a given number of seconds.
public sleep ( integer $seconds ) : void
$seconds integer
return void
Example #1
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if ($this->downForMaintenance() && $this->option('once')) {
         return $this->worker->sleep($this->option('sleep'));
     }
     // We'll listen to the processed and failed events so we can write information
     // to the console as jobs are processed, which will let the developer watch
     // which jobs are coming through a queue and be informed on its progress.
     $this->listenForEvents();
     $connection = $this->argument('connection') ?: $this->laravel['config']['queue.default'];
     // 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->option('queue') ?: $this->laravel['config']->get("queue.connections.{$connection}.queue", 'default');
     $response = $this->runWorker($connection, $queue);
 }
Example #2
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if ($this->downForMaintenance() && !$this->option('daemon')) {
         return $this->worker->sleep($this->option('sleep'));
     }
     // We'll listen to the processed and failed events so we can write information
     // to the console as jobs are processed, which will let the developer watch
     // which jobs are coming through a queue and be informed on its progress.
     $this->listenForEvents();
     $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->runWorker($connection, $queue, $delay, $memory, $this->option('daemon'));
 }
Example #3
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if ($this->downForMaintenance() && !$this->option('daemon')) {
         return $this->worker->sleep($this->option('sleep'));
     }
     $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');
     $response = $this->runWorker($connection, $queue, $delay, $memory, $this->option('daemon'));
     // If a job was fired by the worker, we'll write the output out to the console
     // so that the developer can watch live while the queue runs in the console
     // window, which will also of get logged if stdout is logged out to disk.
     if (!is_null($response['job'])) {
         $this->writeOutput($response['job'], $response['failed']);
     }
 }