/** * Release the job back into the queue. * * @param int $delay * @return void */ public function release($delay = 0) { // Update the Job status $this->job->status = Job::STATUS_OPEN; // Wait for the delay if ($delay) { sleep($this->getSeconds($delay)); } $this->job->save(); }
/** * Store the job in the database. * * Returns the id of the job. * * @param string $job * @param mixed $data * @param int $delay * * @return int */ public function storeJob($job, $data, $delay = 0) { $payload = $this->createPayload($job, $data); $job = new Job(); $job->status = Job::STATUS_OPEN; $job->delay = $delay; $job->payload = $payload; $job->save(); return $job->id; }