laravel-queue

How to remove all queued jobs because it's causing errors?

风流意气都作罢 提交于 2019-12-11 01:29:41
问题 My website queues email sending jobs to the jobs table. I think the email server has some problem and it can't send emails so the jobs are stuck at the jobs table. Now maybe there are too many jobs, and I receive this error message: Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 (SQL: update `jobs` set `reserved_at` = 1510263884, `attempts` = 256 where `id` = 342)' in /var

Laravel check if job extends a certain class

99封情书 提交于 2019-12-10 11:54:29
问题 I know you can listen to job events using before , after and failing hooks: https://laravel.com/docs/5.6/queues#job-events Queue::before(function (JobProcessing $event) { // $event->connectionName // $event->job // $event->job->payload() }); I only want certain jobs to be picked up here though. These jobs are the ones that extend from a certain abstract base class called AbstractTask . Normally I would simply perform an instanceof check but something like this won't work: $job instanceof

Laravel 5.4 saving models via async queue

╄→гoц情女王★ 提交于 2019-12-07 15:16:02
问题 So I am trying to optimize my site and on every page load and exit I save a metric (time on page, ip address etc) for analytics. However these are decent sized bottlenecks on my server. When viewing the time it takes for things to run my entire function takes ~1-2ms and then saving to the DB takes ~100-200ms. So my goal is to run my function and then dispatch a new job, that will do the actual saving of the metric. This way all of the saving of my models can be offloaded to a queue. Below is

Multi-Threading in Laravel

天大地大妈咪最大 提交于 2019-12-07 09:21:16
问题 I am running into a problem where my database calls are slowing up the page load significantly. I am populating multiple charts from elections data, and my table contains around 1 million rows, and I have to query this data multiple times in each methods inside the getCharts() method. I'am using this to pass the return data to JavaScript. These charts gets re-populated when you click on a data point. So if you click on a point i.e ('democrat) it will reload the page and call these methods

Laravel 5.4 saving models via async queue

痞子三分冷 提交于 2019-12-05 21:23:57
So I am trying to optimize my site and on every page load and exit I save a metric (time on page, ip address etc) for analytics. However these are decent sized bottlenecks on my server. When viewing the time it takes for things to run my entire function takes ~1-2ms and then saving to the DB takes ~100-200ms. So my goal is to run my function and then dispatch a new job, that will do the actual saving of the metric. This way all of the saving of my models can be offloaded to a queue. Below is a copy of my job class SaveMetric implements ShouldQueue { use Dispatchable, InteractsWithQueue,

Multi-Threading in Laravel

旧巷老猫 提交于 2019-12-05 12:01:13
I am running into a problem where my database calls are slowing up the page load significantly. I am populating multiple charts from elections data, and my table contains around 1 million rows, and I have to query this data multiple times in each methods inside the getCharts() method. I'am using this to pass the return data to JavaScript. These charts gets re-populated when you click on a data point. So if you click on a point i.e ('democrat) it will reload the page and call these methods again. What I am asking is wether it is possible to do something like this in native PHP. The server is

Running laravel queue:work on a shared hosting

依然范特西╮ 提交于 2019-12-04 13:32:39
I want my laravel queue:work to keep running on a shared hosting, this is a shared hosting (am not on a VPS) I can't install anything because almost all online sources when I was searching for this suggest installing supervisor. So basically I thought I could just create a cron job that checks if queue is not running and starts it, any help on how to go about this because am kinda stuck, thanks. P.S. Am on a Linux server and Laravel 5.3 As you mentioned you are using shared hosting, You follow the below steps. Step 1. you need to setup your queue driver as database Step 2 you need to setup a

The “--queued” option does not exist in Laravel 5.4

别来无恙 提交于 2019-12-03 10:27:29
问题 I'm going to create Queue job for mailing. once I hit the artisan command in command prompt php artisan make:job SendSMSMessages --queued I got the issue as is follow. The "--queued" option does not exist. I'm using Laravel 5.4 Please anyone can help me for the same. I have searched a lot but didn't found any good solutions. Thanks 回答1: The option --queued, was introduced in Laravel 5.0, and remained an option until version Laravel 5.1 https://laravel.com/docs/5.1/queues#writing-job-classes

The “--queued” option does not exist in Laravel 5.4

狂风中的少年 提交于 2019-12-02 23:48:51
I'm going to create Queue job for mailing. once I hit the artisan command in command prompt php artisan make:job SendSMSMessages --queued I got the issue as is follow. The "--queued" option does not exist. I'm using Laravel 5.4 Please anyone can help me for the same. I have searched a lot but didn't found any good solutions. Thanks The option --queued, was introduced in Laravel 5.0, and remained an option until version Laravel 5.1 https://laravel.com/docs/5.1/queues#writing-job-classes Since Laravel version 5.2 onwards, --queued was deperecated as by default all newly created jobs are "queued"

when using laravel queue job processing, getting stuck

拟墨画扇 提交于 2019-12-01 09:11:34
i am on 5.3.31 so it cannot be related to https://github.com/laravel/framework/issues/15179 after 300ish jobs I get: [2017-04-11 13:51:53] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function beginTransaction() on null in /var/www/html/www.myapp.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:612 Stack trace: #0 /var/www/html/www.myapp.com/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php(175): Illuminate\Database\Connection->beginTransaction() #1 /var/www/html/www.myapp.com/vendor/laravel/framework/src/Illuminate/Queue