Queue - Pending Jobs

Version ie <v5.12.44>

Environment

Checklist

  • Have you searched existing issues?
    Yes, I reported this issue in the following topic:
    Queue - Failed Jobs

Describe the bug

In the Queue are pending jobs and they have to be flushed manually with the following console command:

php artisan queue:work database --queue=scout

Expected Behavior

A fix to prevent pending jobs

Screenshots

Is there a fix to have no pending jobs in Queue?

Hi,

Have you configured the queue:work cron to process the jobs?

I’ve checked it. Actually only this is active:
cd /home/www/invoice && /usr/bin/php -d register_argc_argv=On artisan schedule:run

Now I added a new cronj cd /home/www/invoice && /usr/bin/php -d register_argc_argv=On artisan queue:work database --stop-when-emptyob:

Hope this works now.
Thank you for your help :heart:

1 Like

Hi! :slight_smile:
I use a cronjob with following command:
cd /home/www/invoice && /usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty

I receive a e-mail, when the job is finished, with this details:

But still 5 jobs are pending:

It’s a shared hosting.
Am I mistaken in thinking that it won’t work?

Or can you give me a hint as to how to solve this?

Are you able to test the cron from the command line?

Yes, you can see it here.
image

But after finishing this job, the queue is still pending:

Or, did I have to implement the following command into a cronjob?

php artisan queue:work database --queue=scout

I believe it’s correct, have you seen the docs:

Are there any errors in storage/logs?

Yes, create a cron job

0 * * * * php /usr/share/nginx/invoiceninja/artisan queue:work database --queue=scout

Not really, there are 2 old error messages:

[2025-05-06 20:31:23] production.ERROR: No application encryption key has been specified. {“exception”:"[object] (Illuminate\Encryption\MissingAppKeyException(code: 0): No application encryption key has been specified. at /home/www/invoice/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:83)
[stacktrace]

And this one:

[2025-05-12 11:31:02] production.ERROR: Elastic\Elasticsearch\ClientBuilder::setBasicAuthentication(): Argument #1 ($username) must be of type string, null given, called in /home/www/invoice/vendor/elasticsearch/elasticsearch/src/ClientBuilder.php on line 168 {“exception”:"[object] (TypeError(code: 0): Elastic\Elasticsearch\ClientBuilder::setBasicAuthentication(): Argument #1 ($username) must be of type string, null given, called in /home/www/invoice/vendor/elasticsearch/elasticsearch/src/ClientBuilder.php on line 168 at /home/www/invoice/vendor/elasticsearch/elasticsearch/src/ClientBuilder.php:242)

I’m on shared hosting and did’t find no nginx Folder…
Did I have to choose in this case: /usr/bin/php ?

cd /home/www/invoice && php artisan queue:work database --queue=scout

I’ve changed the cronjob to this command and it seems that it works for the moment…
…I’m monitoring this case :smiley:

2 Likes

Oh, yes, the path needs to be adjusted

1 Like

Actually it works :smiling_face_with_three_hearts:
Thank you for all the hinds! :smiling_face_with_sunglasses: :+1:

1 Like