예제 #1
0
 /**
  * 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;
     $this->job->save();
     // Wait for the delay
     if ($delay) {
         sleep($this->getSeconds($delay));
     }
     // Fire again
     $this->fire();
 }
 /**
  * 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);
     $database = Config::get('database');
     if ($database['default'] === 'odbc') {
         $row = DB::select(DB::raw("SELECT laq_async_queue_seq.NEXTVAL FROM DUAL"));
         $id = $row[0]->nextval;
         $job = new Job();
         $job->id = $id;
         $job->status = Job::STATUS_OPEN;
         $job->delay = $delay;
         $job->payload = $payload;
         $job->save();
     } else {
         if ($database['default'] === 'mysql') {
             $payload = $this->createPayload($job, $data);
             $job = new Job();
             $job->status = Job::STATUS_OPEN;
             $job->delay = $delay;
             $job->payload = $payload;
             $job->save();
             $id = $job->id;
         }
     }
     return $id;
 }
 /**
  * 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;
 }