5

Very new to queues so be gentle. To my understanding, $job->release() is supposed to put the job back on the queue. I currently have the code below but it only runs the job through the queue once. I need to be able to run it through up to 5 times and if it fails again, delete it or something.

Worker:

public function fire($job, $data)
{
    if ($job->attempts() < 5) {
        \Log::error($job->attempts());
        $job->release();
    }

}

PUSH!:

 Queue::push(
     'ClassName',
      [
         'path' => $path;
      ]

Trying to do this locally with sync. Tried running queue:listen and queue:work, then running the push code. Only logged 1 entry. Let me know if you need more info.

Dylan Buth
  • 1,648
  • 5
  • 35
  • 57

1 Answers1

9

Turns out $job->release() doesn't work when using the sync driver.

Dylan Buth
  • 1,648
  • 5
  • 35
  • 57
  • 4
    The `sync` driver is essentially the same as running your code synchronously, so there is no queue to release the job back to. – flyingL123 May 15 '15 at 19:30