Open antoinelame opened 3 years ago
Running php artisan queue:listen
. seems to work but this is a less than ideal solution. This closes after each job and sends the logs, is there a way it can keep working without closing after each job as done by php artisan queue:work
any update on this? we are encountering this as well.
Finally found THE trick Change the buffer size to 1 !! That's it !
Finally found THE trick
Change the buffer size to 1 !!
That's it !
What do you mean?
$handler = new CloudWatch($client, $groupName, $streamName, $retentionDays, 10000, $tags);
to
$handler = new CloudWatch($client, $groupName, $streamName, $retentionDays, 1, $tags);
If you look at the protected function write
in Cloudwatch.php in the package you'll see the following
if (count($this->buffer) >= $this->batchSize) { $this->flushBuffer(); }
That's why
Does this affect performance sending a log at a time
Description
Logs from an asynchronous job in a Laravel queue are not sent to CloudWatch until you shutdown the queue process.
This is because
php artisan queue:work
does not close the process. Queue workers do not "reboot" the framework before processing each job.How to reproduce
Note: make sure that in your
.env
you do not use thesync
queue driver.GET /dispatch-job
You will receive the logs in CloudWatch only when you'll interrupt the
queue:work
command. Not before.Related GitHub issues
7