public function testPerfQueueLength() { $queue = new Qless\Queue("testQueue", $this->client); $cb = $this->getProfilerForCallback(function ($e) use($queue) { $queue->length(); }); $cb(self::TEST_TIME, __METHOD__); }
/** * @expectedException \Qless\InvalidJobException */ public function testThrowsInvalidJobExceptionWhenRequeuingCancelledJob() { $queue = new Qless\Queue("testQueue", $this->client); $testData = ["performMethod" => 'myPerformMethod', "payload" => "otherData"]; $queue->put("Sample\\TestWorkerImpl", "jid-1", $testData, 0, 0, true, 1, [], 5, ['tag1', 'tag2']); $job = $queue->pop("worker-1")[0]; $this->client->cancel('jid-1'); $job->requeue(); }
<?php require_once '../lib/Qless/Worker.php'; require_once '../lib/Qless/Queue.php'; require_once '../lib/Qless/Client.php'; require_once 'TestWorkerImpl.php'; $client = new Qless\Client('localhost', 6380); $queue = new Qless\Queue("testQueue1", $client); $queue2 = new Qless\Queue("testQueue2", $client); $testData1 = ["performMethod" => 'myPerformMethod', "payload" => "otherData"]; //$testData1 = ["performMethod"=>'myThrowMethod',"payload"=>"otherData"]; $testData2 = ["performMethod" => 'exitMethod', "payload" => "otherData"]; $ret = $queue->put(null, "TestWorkerImpl", "jobTestDEF", $testData1); if ($ret) { echo "successfully put on queue.\n"; } else { echo "failed put on queue.\n"; } $ret = $queue->put(null, "TestWorkerImpl", "jobTestGHI", $testData2); if ($ret) { echo "successfully put on queue.\n"; } else { echo "failed put on queue.\n"; }
public function testJobWithIntervalIsThrottled() { $queue = new Qless\Queue("testQueue", $this->client); $queue->put("Sample\\TestWorkerImpl", "jid-1", [], 0, 5, true, 0, [], 60); $job = $queue->pop('worker')[0]; $job->complete(); $queue->put("Sample\\TestWorkerImpl", "jid-1", [], 0, 5, true, 0, [], 60); $job = $queue->pop('worker'); $this->assertEmpty($job); }