Support the ongoing development of Laravel.io →
posted 11 years ago
Queues

I have a few things I want to clarify about about maintenance mode:

  • existing web requests will keep running, but new requests will be denied?

  • if the queue is not in daemon mode, we can safely leave it untouched and everything will work out?

From what I understand, queue:listen sits there polling the queue and when it knows something is there, it spawns a queue:work which pulls the top item off the queue, does the work, and exits. Since the logic for queue:listen will hardly change in a deployment (unless a major framework upgrade), I assume it's safe to keep it running, and it will be eventually restarted by Supervisor anyway. Since it's running command line processes for queue:work, and the framework is booted each time, there shouldn't be any problem leaving the queue untouched upon deployment. This is the same reason we don't need to worry about web requests that haven't completed yet -- the code is already loaded and being executed, and any jobs that get run will always be using the current code.

However, I understand this is different for daemon queues, which you need to specifically restart since the whole point is that they don't boot the framework each time to save resources. We wouldn't want a new job pushed by the app which has new code to end up being processed by the daemon running old code.

From what I understand, a daemon worker will stop accepting jobs off the queue once in maintenance mode, but will keep working on things it already has. Therefore, I guess the only way is to make an educated guess as to when the jobs on the queue are likely to be done and wait that long before telling Supervisor to restart them. There might be a better way with a single queue to avoid the problem by sending a job to the queue to take the app down, ensuring nothing is lost, but I don't think that's possible to coordinate with multiple queues.

I would definitely like to leverage the daemon worker for the less resource use, but I think it's reasonable to feel uneasy about the "just wait and hope the jobs finish timely" approach. Thoughts?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

maknz maknz Joined 13 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.