Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2] Adding proper alias for FailedJobProviderInterface #13088

Merged
merged 1 commit into from
Apr 9, 2016

Conversation

dbpolito
Copy link
Contributor

@dbpolito dbpolito commented Apr 8, 2016

Failed Job feature isn't working when using command:

php artisan queue:work --daemon --tries=3

It fails because the command gets a new instance of Worker and it fails to find the FailedJobProviderInterface dependency.

With this fix i think we also can get rid of this if: https://github.com/laravel/framework/blob/5.2/src/Illuminate/Queue/Worker.php#L302

As now it will always have a failer object, this was probably a bad fix for this issue.

PS: This issue might also be happening on older versions.

@taylorotwell
Copy link
Member

I am unable to recreate this. The command works for me and correctly inserts failed job into database table.

@dbpolito
Copy link
Contributor Author

dbpolito commented Apr 9, 2016

Interesting, if i use directly:

php artisan queue:work --daemon --tries=3

It works, but if i call:

php artisan my:work --daemon --tries=3

It doesn't work without my fix.

My Work is just:

namespace App\Console\Commands;

use Illuminate\Queue\Console\WorkCommand;
use Symfony\Component\Console\Input\InputOption;

class Work extends WorkCommand
{
    protected $name = 'my:work';

    public function fire()
    {
        if ($customer = $this->option('customer')) {
            // do some simple stuff
        }

        return parent::fire();
    }

    protected function getOptions()
    {
        return array_merge(
            parent::getOptions(),
            [['customer', null, InputOption::VALUE_REQUIRED, 'The name of customer']]
        );
    }
}

Even if i don't overwrite any method on my class, i just extend and change the name, it still doesn't work without my fix.

@taylorotwell taylorotwell merged commit 2eb5551 into laravel:5.2 Apr 9, 2016
@taylorotwell
Copy link
Member

Well your change looks fine so I'll go ahead and merge it then.

@dbpolito
Copy link
Contributor Author

@taylorotwell

Hey man, just curious, but how often do you tag new versions? With something big is merged? Weekly? Just curious because i need this and i will need to use dev-5.2 while you don't tag it...

No problem on that at all, just curious. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants