kainxspirits / laravel-pubsub-queue

A Laravel queue driver for Google PubSub.
MIT License
45 stars 36 forks source link

using the queue worker with --stop-when-empty, quits suddenly #22

Closed v8-ict closed 5 years ago

v8-ict commented 5 years ago

Currently the driver shows unexpected behaviour when using --stop-when-empty.

It suddenly quits, while jobs are left on the queue. In my opinion this is caused by

PubSubQueue.php:139 $messages = $subscription->pull([ 'returnImmediately' => true, 'maxMessages' => 1, ]);

See: https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/pull See 'returnImmediately'

I was wondering if you guys would be oke if i submit a PR to change this to false.

OR

Should it be configurable?, i couldn't imagine a reason why you would put it on ``true``` But i guess you guys might have a valid reason for it.

You might think... wtf even use --stop-on-empty ...

It is very useful when you use a laravel or lumen job as Kubernetes Cronjob especially with this pub-sub driver, it doesn't need any side car containers. and can run a lean job or cronjob

kainxspirits commented 5 years ago

Hi @v8-ict

This is a very specific case, so we won't change that behavior. I personally don't mind making it configurable. But not a priority at the moment.

Feel free to submit a PR.