简体   繁体   中英

Laravel Queue Job doesn't respect timeout

I have this process setting.

php artisan queue:work beanstalkd --sleep=3 --tries=1 --timeout=0 --queue=medium,messages

I also have a job with the setting

public $timeout = 100000000;

But the job is stopped much before that with message has been attempted too many times or run too long. The job may have previously timed out has been attempted too many times or run too long. The job may have previously timed out Which was run for the first time.

I also have this in php.ini

max_execution_time = 0

What am I missing here?

Console

Things I want to execute from the command line (As you mentioned with your job creates more jobs). But the thing is, you could extract the business logic of it to a command .

Example : A console command with fires a command to fetch images from Imgur. The Class FetchImages contains the actual business logic of fetching images.

Command

Class which contains the actual logic. You should also be able to call this command from your application with app()->make(Command::class)->handle() .

Example : Command mentioned in Example 1. Contains logic which does the actual API calls to Imgur and process returned data.

Jobs

Laravel 5.0 so jobs weren't a thing back then. But as I see it, Jobs are like commands but they are queued and can be dispatched. (As you may have seen in those examples, those commands implement your mentioned Interfaces SelfHandling and ShouldBeQueued ).


I see changes in Commands and Jobs are quite difficult to understand.

EDIT: From the Laravel Docs:

The app/Commands directory has been renamed to app/Jobs. However, you are not required to move all of your commands to the new location, and you may continue using the make:command and handler:command Artisan commands to generate your classes.

Likewise, the app/Handlers directory has been renamed to app/Listeners and now only contains event listeners. However, you are not required to move or rename your existing command and event handlers, and you may continue to use the handler:event command to generate event handlers.

By providing backwards compatibility for the Laravel 5.0 folder structure, you may upgrade your applications to Laravel 5.1 and slowly upgrade your events and commands to their new locations when it is convenient for you or your team.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM