public function replaceHandlerIfQueueIsEnabled(&$handler) { $settings = Queue\Factory::getSettings(); if ($settings->queueEnabled->getValue()) { $handler = new Handler(); if ($settings->processDuringTrackingRequest->getValue()) { $handler->enableProcessingInTrackerMode(); } } }
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(); }