I'm having some issues getting a job to run in my Laravel 4 setup. I have it working on Homestead, however it doesn't work on production. I'm using Beanstalkd (with pheanstalk), and Supervisor, following this tutorial.
In a nutshell, I want to delete an image which is on my server, 20 seconds after the job has been called.
Queue::later(20, 'App\Queues\FileHandler@delete', ['file' => $file]);
$file
is the path to my file.
My delete method:
public function delete($job, $data)
{
var_dump($data);
if (File::exists($data['file']))
File::delete($data['file']);
$job->delete();
}
I also installed Beanstalkd Console.
Right, so when I click the button, it triggers the queue. I can see on the console the console that it now has the correct $data
, with the correct path to the file.
On the console, the time-left
counts down from 20... and when it hits 0, it resets to a very large number (18446744073666). There is no errors/output in the logs.
As soon as I "kick" the job from the console, it executes and my file deletes, so I know the code is sound.
Anyone got any suggestions, its really annoying me :(