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.4] Undocumented change to queue:listen behavior from 5.3 #17645

Closed
laurencei opened this issue Jan 29, 2017 · 1 comment
Closed

[5.4] Undocumented change to queue:listen behavior from 5.3 #17645

laurencei opened this issue Jan 29, 2017 · 1 comment

Comments

@laurencei
Copy link
Contributor

laurencei commented Jan 29, 2017

  • Laravel Version: 5.4.6
  • PHP Version: 7.1
  • Redis queue

Description:

There is a definite change to the behavior of queue:listen between 5.3 and 5.4 that doesn't seem to be listed in the documentation. I am not sure if it is a bug, or an intended change.

Steps To Reproduce:

  1. Create a job that will fail for some reason:
<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class BadJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        \Log::info('Bad Job running');
        abort(500);
    }
}
  1. Now queue that job somewhere:

\Queue::push(new \App\Jobs\BadJob());

  1. Run the following job on Laravel 5.1, 5.2 or 5.3:

artisan queue:listen --tries=3

I get three "bad job running" in my logs - then the job fails (and queue:failing fires)

  1. If I run that same command on Laravel 5.4 - the logs fill up with bad job running indefinitely (i.e. it never stops). It is ignoring the --tries=X command and never fires the 'queue:failing' event either.

If I add public $tries = 5;

to the BadJob as per the Laravel 5.4 document - then it honors the 5 tries and will stop then. But the documentation says that $tries is optional, and it is not listed as part of the upgrade requirements (i.e. needing to go and add $tries to all the jobs).

As a side note - running queue:work --tries=3 does cause the job to correctly fail in both 5.3 and 5.4.

Sepix pushed a commit to Sepix/framework that referenced this issue Jan 31, 2017
ListenerOptions was missing force and tries options.
@themsaid
Copy link
Member

thank you :)

fix submitted #17687

taylorotwell pushed a commit that referenced this issue Jan 31, 2017
ListenerOptions was missing force and tries options.
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

No branches or pull requests

2 participants