@@ -2,11 +2,9 @@ |
||
| 2 | 2 | namespace Dtc\QueueBundle\Command; |
| 3 | 3 | |
| 4 | 4 | use Dtc\QueueBundle\Documents\Job; |
| 5 | - |
|
| 6 | 5 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
| 7 | 6 | use Symfony\Component\Console\Input\InputArgument; |
| 8 | 7 | use Symfony\Component\Console\Input\InputInterface; |
| 9 | -use Symfony\Component\Console\Input\InputOption; |
|
| 10 | 8 | use Symfony\Component\Console\Output\OutputInterface; |
| 11 | 9 | |
| 12 | 10 | class CreateJobCommand |
@@ -2,9 +2,7 @@ |
||
| 2 | 2 | namespace Dtc\QueueBundle\Command; |
| 3 | 3 | |
| 4 | 4 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
| 5 | -use Symfony\Component\Console\Input\InputArgument; |
|
| 6 | 5 | use Symfony\Component\Console\Input\InputInterface; |
| 7 | -use Symfony\Component\Console\Input\InputOption; |
|
| 8 | 6 | use Symfony\Component\Console\Output\OutputInterface; |
| 9 | 7 | |
| 10 | 8 | class PruneCommand |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace Dtc\QueueBundle\Command; |
| 3 | 3 | |
| 4 | 4 | use Dtc\QueueBundle\Model\Job; |
| 5 | - |
|
| 6 | 5 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
| 7 | 6 | use Symfony\Component\Console\Input\InputArgument; |
| 8 | 7 | use Symfony\Component\Console\Input\InputInterface; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | set_time_limit($processTimeout); // Set an hour timeout |
| 69 | 69 | |
| 70 | 70 | if ($jobId = $input->getOption('job_id')) { |
| 71 | - return $this->runJobById($jobId); // Run a single job |
|
| 71 | + return $this->runJobById($jobId); // Run a single job |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | try { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | protected function reportJob(Job $job) |
| 97 | 97 | { |
| 98 | 98 | if ($job->getStatus() == Job::STATUS_ERROR) { |
| 99 | - $message = "Error with job id: {$job->getId()}\n" . $job->getMessage(); |
|
| 99 | + $message = "Error with job id: {$job->getId()}\n".$job->getMessage(); |
|
| 100 | 100 | $this->logger->error($message); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -3,10 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
| 5 | 5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
| 6 | - |
|
| 7 | 6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 8 | -use Symfony\Component\HttpFoundation\Response; |
|
| 9 | -use Symfony\Component\HttpFoundation\Request; |
|
| 10 | 7 | |
| 11 | 8 | class QueueController |
| 12 | 9 | extends Controller |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Dtc\QueueBundle\Model\Job as BaseJob; |
| 5 | 5 | use Dtc\QueueBundle\Model\JobManagerInterface; |
| 6 | - |
|
| 7 | 6 | use PhpAmqpLib\Connection\AMQPConnection; |
| 8 | 7 | use PhpAmqpLib\Message\AMQPMessage; |
| 9 | 8 | |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function __construct(AMQPConnection $connection) { |
| 17 | 17 | $this->connection = $connection; |
| 18 | - $this->channel = $connection->channel();; |
|
| 18 | + $this->channel = $connection->channel(); ; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function save($job) { |
| 22 | 22 | $queue = $job->getWorkerName(); |
| 23 | - $exchange = null; // User default exchange |
|
| 23 | + $exchange = null; // User default exchange |
|
| 24 | 24 | |
| 25 | 25 | $this->channel->queue_declare($queue, false, true, false, false); |
| 26 | 26 | $this->channel->exchange_declare($exchange, 'direct', false, true, false); |
@@ -3,10 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Dtc\QueueBundle\BeanStalkd\JobManager; |
| 5 | 5 | use Dtc\QueueBundle\Model\Job; |
| 6 | -use Dtc\QueueBundle\Model\WorkerManager; |
|
| 7 | - |
|
| 8 | 6 | use Dtc\QueueBundle\Tests\FibonacciWorker; |
| 9 | -use Dtc\QueueBundle\Tests\StaticJobManager; |
|
| 10 | 7 | use Dtc\QueueBundle\Tests\Model\BaseJobManagerTest; |
| 11 | 8 | |
| 12 | 9 | /** |
@@ -3,12 +3,8 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Dtc\QueueBundle\Tests\Model\BaseJobManagerTest; |
| 5 | 5 | use Dtc\QueueBundle\Tests\FibonacciWorker; |
| 6 | -use Dtc\QueueBundle\Tests\StaticJobManager; |
|
| 7 | - |
|
| 8 | -use Dtc\QueueBundle\Model\WorkerManager; |
|
| 9 | 6 | use Dtc\QueueBundle\Documents\JobManager; |
| 10 | 7 | use Dtc\QueueBundle\Model\Job; |
| 11 | - |
|
| 12 | 8 | use Doctrine\MongoDB\Connection; |
| 13 | 9 | use Doctrine\ODM\MongoDB\Configuration; |
| 14 | 10 | use Doctrine\ODM\MongoDB\DocumentManager; |
@@ -41,14 +41,14 @@ |
||
| 41 | 41 | $config->setHydratorDir('/tmp/dtcqueuetest/generate/hydrators'); |
| 42 | 42 | $config->setHydratorNamespace('Hydrators'); |
| 43 | 43 | |
| 44 | - $classPath = __DIR__ . '../../Documents'; |
|
| 44 | + $classPath = __DIR__.'../../Documents'; |
|
| 45 | 45 | $config->setMetadataDriverImpl(AnnotationDriver::create($classPath)); |
| 46 | 46 | |
| 47 | 47 | self::$dm = DocumentManager::create(new Connection(), $config); |
| 48 | 48 | |
| 49 | 49 | $documentName = 'Dtc\QueueBundle\Documents\Job'; |
| 50 | 50 | $sm = self::$dm->getSchemaManager(); |
| 51 | - $timeout = 1000; |
|
| 51 | + $timeout = 1000; |
|
| 52 | 52 | |
| 53 | 53 | $sm->dropDocumentCollection($documentName); |
| 54 | 54 | $sm->createDocumentCollection($documentName); |
@@ -2,9 +2,6 @@ |
||
| 2 | 2 | namespace Dtc\QueueBundle\Tests\Model; |
| 3 | 3 | |
| 4 | 4 | use Dtc\QueueBundle\Model\Job; |
| 5 | -use Dtc\QueueBundle\Tests\FibonacciWorker; |
|
| 6 | -use Dtc\QueueBundle\Tests\StaticJobManager; |
|
| 7 | -use Dtc\QueueBundle\Model\WorkerManager; |
|
| 8 | 5 | |
| 9 | 6 | class BaseJobManagerTest |
| 10 | 7 | extends \PHPUnit_Framework_TestCase |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | public function testPerformance() { |
| 84 | 84 | $start = microtime(true); |
| 85 | 85 | $jobsTotal = 1000; |
| 86 | - self::$jobManager->enableSorting = false; // Ignore priority |
|
| 86 | + self::$jobManager->enableSorting = false; // Ignore priority |
|
| 87 | 87 | |
| 88 | 88 | for ($i = 0; $i < $jobsTotal; $i++) { |
| 89 | 89 | self::$worker->later()->fibonacci(1); |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | use Dtc\QueueBundle\Model\Job; |
| 5 | 5 | use Dtc\QueueBundle\Tests\FibonacciWorker; |
| 6 | 6 | use Dtc\QueueBundle\Tests\StaticJobManager; |
| 7 | -use Dtc\QueueBundle\Model\WorkerManager; |
|
| 8 | 7 | |
| 9 | 8 | class JobTest |
| 10 | 9 | extends \PHPUnit_Framework_TestCase |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | $worker = new FibonacciWorker(); |
| 14 | 14 | $job = new Job($worker, false, null); |
| 15 | 15 | $job->setArgs(array(1)); |
| 16 | - $job->setArgs(array(1, array(1,2))); |
|
| 16 | + $job->setArgs(array(1, array(1, 2))); |
|
| 17 | 17 | |
| 18 | 18 | try { |
| 19 | 19 | $job->setArgs(array($job)); |