public function testAddJobDelayed() { $queue = 'test-' . substr(sha1(mt_rand()), 0, 6); $producer = new Producer($this->stream); $consumer = new Consumer($this->stream); $job = new Job("foo"); $job->setDelay(1); $job->setTtl(4); $job->setRetry(1); $this->assertEquals('', $job->getId()); $producer->addJob($queue, $job); $this->assertNotEquals('', $job->getId()); $this->assertNull($consumer->getJob($queue, 500)); // now the job should be returned $j = $consumer->getJob($queue, 5000); $this->assertInstanceOf('\\Phloppy\\Job', $j); }
/** * Send a notice to the server that this client is still processing the job. * * @param Job $job * * @return int The current retry time for the job * * @see https://github.com/antirez/disque#working-jobid */ public function working(Job $job) { return (int) $this->send(['WORKING', $job->getId()]); }