2

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 :(

Alias
  • 2,983
  • 7
  • 39
  • 62

1 Answers1

4

Version 1.4.6 had an issue with delayed jobs. Upgrade to 1.5 or 1.6 if your running on 1.4.6

Erik-Jan Riemers
  • 1,154
  • 8
  • 18
  • Thanks. Issue was on 1.4.6 it seems! – Alias Oct 24 '14 at 13:45
  • 1
    Ok this may be dumb but how does one upgrade from 1.4.6? `apt-get install beanstalkd` just gave me 1.4.6. Do I have to manually download it? – Dylan Buth Jan 21 '15 at 17:56
  • 1
    Yes, or find a place where you can download a newer one from another distro. I had to move heaven and earth to get a newer version working. https://launchpad.net/~jernej/+archive/ubuntu/beanstalkd/+packages helped me. – Erik-Jan Riemers Jan 22 '15 at 09:16
  • Thanks, I had the same problem using debian wheezy. Adding `deb http://ppa.launchpad.net/jernej/beanstalkd/ubuntu YOUR_UBUNTU_VERSION_HERE main` to the `/etc/apt/sources.list` helped. To detect the right ubuntu version for the debain version installed this was very usefull[link](https://askubuntu.com/a/445496/413377). Hopefully this helps the next one :-) – simon May 24 '15 at 22:45