public static function makeQueueManager(Backend $backend) { $settings = self::getSettings(); $lock = self::makeLock($backend); $manager = new Manager($backend, $lock); $manager->setNumberOfAvailableQueues($settings->numQueueWorkers->getValue()); $manager->setNumberOfRequestsToProcessAtSameTime($settings->numRequestsToProcess->getValue()); return $manager; }
public function test_process_shouldRestoreEnvironmentAfterTrackingRequests() { $serverBackup = $_SERVER; $this->queue->setNumberOfRequestsToProcessAtSameTime(1); $requestSet = $this->buildRequestSet(5); $requestSet->setEnvironment(array('server' => array('test' => 1))); $this->queue->addRequestSetToQueues($requestSet); $tracker = $this->process(); $this->assertSame(5, $tracker->getCountOfLoggedRequests()); $this->assertEquals($serverBackup, $_SERVER); }
public function test_process_ShouldNotDirectlyProcessQueue_IfAlreadyLocked() { Queue\Factory::getSettings()->numQueueWorkers->setValue(1); $this->handler->enableProcessingInTrackerMode(); $this->queue->setNumberOfRequestsToProcessAtSameTime(1); // there is only one worker, so make sure that queue is locked $lock = new Queue\Lock($this->backend); $lock->acquireLock(0); $this->assertSame(0, $this->queue->getNumberOfRequestSetsInAllQueues()); $this->processDummyRequests(); $this->assertSame(1, $this->queue->getNumberOfRequestSetsInAllQueues()); $this->processDummyRequests(); $this->assertSame(2, $this->queue->getNumberOfRequestSetsInAllQueues()); $this->queue->unlock(); }