joedawson's avatar

Why is my artisan command not completing?

Hello all,

I currently have an artisan command that is used to create a video, it uses Symfony's Process Component.

After the the Process has finished, my command just doesn't finish and throws an error...

[Pheanstalk\Exception\ServerException] Job 4 NOT_FOUND: does not exist or is not reserved by client

Here's my current code:

public function fire()
{
    /* ------------------------------------
    #. Get the Track
    ------------------------------------ */
    $track = Track::findOrFail($this->argument('track_id'));

    /* ------------------------------------
    #. Path to Files
    ------------------------------------ */
    $imagePath = public_path('image.jpg');
    $videoPath = public_path('processed/' . $track->slug . '.mov');

    /* ------------------------------------
    #. Create the Video
    ------------------------------------ */
    $process =  '/usr/bin/ffmpeg -loop 1 -y -i '.$imagePath.' -i '.$track->uploaded_url.' -shortest -acodec copy -f mov ' . $videoPath;
    $process = new Process($process);
    $process->run();

    /* ------------------------------------
    #. Check the Process
    ------------------------------------ */
    if($process->isSuccessful())
    {
        /* ------------------------------------
        #. Upload the Video
        ------------------------------------ */
        Storage::disk('s3')->put(s3VideoPath($track), file_get_contents($videoPath));

        /* ------------------------------------
        #. Delete the local file, we're done.
        ------------------------------------ */
        File::delete($videoPath);

        /* ------------------------------------
        #. Return Message
        ------------------------------------ */
        return $this->info($process->getOutput());
    }
    else
    {
        return $this->error($process->getErrorOutput());
    }
}

The process is successful, as the video is created - it doesn't upload to S3 then delete the local file, though.

It's like it's timing out or something? After that error, it just throws the job back to being 'ready'.

Can anyone shed light as to why this is failing? Thanks!

0 likes
1 reply
joedawson's avatar
joedawson
OP
Best Answer
Level 18

Fixed this by increasing the time to run (ttr) in config/queue.php

'beanstalkd' => [
    'driver' => 'beanstalkd',
    'host'   => 'localhost',
    'queue'  => 'default',
    'ttr'    => 3600, // Originally 60
],
5 likes

Please or to participate in this conversation.