Package Data | |
---|---|
Maintainer Username: | maxbrokman |
Maintainer Contact: | max.brokman@vice.com (Max Brokman) |
Package Create Date: | 2016-05-05 |
Package Last Update: | 2023-02-01 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:18:04 |
Package Statistics | |
---|---|
Total Downloads: | 150,708 |
Monthly Downloads: | 107 |
Daily Downloads: | 28 |
Total Stars: | 30 |
Total Watchers: | 6 |
Total Forks: | 28 |
Total Open Issues: | 10 |
A Laravel Queue worker that's safe for use with Laravel Doctrine
queue:listen
is unacceptablephp artisan queue:work --daemon
without hitting cascading EntityManager is closed
exceptionsVersion | Supported Laravel Versions ------- | -------------------------- 0.1.* | 5.1, 5.2 0.2.* | ^5.3.16 0.3.* | ^5.4.9
SafeQueue overrides a small piece of Laravel functionality to make the queue worker daemon safe for use with Doctrine. It makes sure that the worker exits if the EntityManager is closed after an exception. For good measure it also clears the EM before working each job.
Install using composer
composer require maxbrokman/safe-queue
Once you've got the codez add the following to your service providers in app.php
MaxBrokman\SafeQueue\DoctrineQueueProvider::class
Create the config file config/safequeue.php
and load it: $app->configure('safequeue');
<?php
return [
/*
|--------------------------------------------------------------------------
| Worker Command Name
|--------------------------------------------------------------------------
|
| Configure the signature / name of the Work Command here. The default
| is to rename the command to 'doctrine:queue:work', however you can
| rename it to whatever you want by changing this value.
|
| To override the Laravel 'queue:work' command name just set this
| to a false value or 'queue:work'.
|
*/
'command_name' => 'doctrine:queue:work',
];
php artisan doctrine:queue:work connection --daemon -sleep=3 --tries=3 ...
All options are identical to Laravel's own queue:work
method.
PRs welcome. Please send PRs to the relevant branch (0.1, 0.2, 0.3
) depending on which version of Laravel you are targeting.
Run tests and style fixer.
vendor/bin/php-cs-fixer fix
vendor/bin/phpunit
I maintain this as part of my day job, please open any issues on Github