Skip to content

Conversation

@amirhshokri
Copy link
Contributor

Description

This PR adds an optional --for flag to the queue:pause Artisan command, allowing a queue to be paused for a fixed number of seconds.

This builds on the existing pauseFor() method already available on the queue manager, making it accessible via the CLI in a consistent and user-friendly way.

Usage

php artisan queue:pause redis:emails --for=300

Without the option, the command behaves exactly as before.

@antonkomarev
Copy link
Contributor

Maybe it will be better to name it --ttl? Because it will be self documented then, and now I expected to see model id or something else there.

@taylorotwell
Copy link
Member

I honestly just don't know what the production use case for this is. What if you're not ready for things to unpause when the ttl is over?

@rodrigopedra
Copy link
Contributor

@taylorotwell

I honestly just don't know what the production use case for this is. What if you're not ready for things to unpause when the ttl is over?

Sometimes an external service has a scheduled maintenance window that they warn their API users about in advance.

One could schedule a queue that consumes that API to be paused for the maintenance window period time, starting at a given time.

Of course, knowing about the outage in advance, one could just schedule both the queue:pause and the queue:resume commands for the given maintenance window.

What happened to me recently was that I missed a maintenance email notice from an external API provider.

Luckily I got flooded by error notifications from my app's backend, so I could pause the queue that consumes that API rapidly.

Upon learning it was a scheduled outage, I could have manually run the queue:pause command with a given time for the expected maintenance time period and not worried about running queue:resume some time later.

In my case, I scheduled an alarm on my phone to remind me to resume the queue. Having the --for option would have been great.

I don't think adding this as an option is a must, but I think it is helpful in those cases.

@amirhshokri amirhshokri deleted the 12.x-add-for-option-to-queue-pause-command branch December 22, 2025 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants