I have a laravel queue setup with a
database
Connection. Note this problem is also on redis. But i am currently using the database connection for the
failed_jobs
Table to help me check any errors that occur during the queue process.
The problem i have is that the queue stops working after a few jobs without any message showing why. But when i restart the command (php artisan queue:work) it picks up the remaining jobs. And continues. (But stops again later)
The job is configured with these values
public $tries = 1;
public $timeout = 10;
The job code is, (Not original code)
public function handle()
{
try {
$file = //function to create file;
$zip = new ZipArchive();
$zip->open(//zip_path);
$zip->addFile(//file_path, //file_name);
$zip->close();
@unlink(//remove file);
} catch (Exception $e) {
Log::error($e);
}
}
And the failed function is setup like this:
public function failed(Exception $exception)
{
Log::error($exception);
$this->fail($exception);
$this->delete();
}
But my there is no failed_job row, And my log is empty
Edit: I added simple info logs after every line of code. And every time i start the queue, It stops after the last line. So the code runs correct. So laravel doesn’t start the new job after that
3
Answers
Did you tried
queue:listen
?Also i guess you need the Supervisor to keep your worker alive.
so what you need here to solve the issue is to do the following steps :
that the snippet is correctly set)
I solved this by increasing memory limit public like this in my code