Exemple #1
0
 /**
  * @return boolean
  */
 protected function runLoop()
 {
     while (true) {
         $this->output->writeln("");
         $this->output->writeln("Waiting for jobs...");
         $job = $this->pheanstalk->reserve();
         $this->output->writeln(sprintf("Received job %s.", $job->getId()));
         if ($this->runJob($job)) {
             $this->output->writeln(sprintf("Delete %s.", $job->getId()));
             $this->pheanstalk->delete($job);
         } else {
             // no handler exists, re-queue for in 60 seconds, maybe restart happend.
             $this->output->writeln(sprintf("Release %s.", $job->getId()));
             $this->pheanstalk->release($job, 100, 60);
         }
     }
 }
Exemple #2
0
 public function testPeekDelayedCommand()
 {
     $testJobId = self::$pheanstalk->putInTube('another-test-tube', serialize('foo'), 1024, 23000);
     $result = `{$this->binPath} peek -t another-test-tube -s delayed`;
     $this->assertRegexp('(ID: ' . $testJobId . ')', $result);
 }
 /**
  * @param Job $job
  */
 public function addJob(Job $job)
 {
     $this->pheanstalk->putInTube('shopware', serialize($job));
 }