Skip to content

Conversation

@jackbayliss
Copy link
Contributor

@jackbayliss jackbayliss commented Nov 30, 2025

In one of my environments, I have 7+ queue workers, each for specific use cases.

Each queue worker hits the cache to check if it should restart and if it needs to pause for each job.

Using the database cache store means this can quickly become quite heavy - as each worker hits the database. It also appears in Nightwatch a lot, which is what led me to this PR. (ie 7 workers, 2 cache keys - each job - within 24 hours- a lot of cache hits!)

image

I'm not going to be using these commands (ie restart or pause) - so it would be nice to add the option to disable them & rather than having to extend the cache manager / adjust the queue.worker singleton with some custom solution, I thought this would be nice and at least help the dx.

TLDR - cache keys are hit alot, feels like a lot of overhead if you don't use the restart/pause commands, this adds a way to turn it off.

They default to false so completely opt in, so shouldn't be any breaking changes. Happy to target 13.x if you prefer & open to feedback- thanks!

@github-actions
Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@jackbayliss jackbayliss force-pushed the 12.x-ability-to-prevent-cache branch from c67ff04 to ec28c3d Compare November 30, 2025 01:37
@rodrigopedra
Copy link
Contributor

We had a similar PR (#57957) a couple of days ago that got closed.

In case you want to avoid these checks, you can try the code I added within a comment there:

#57957 (comment)

Changing the if check to something like:

if (str_starts_with($key, 'illuminate:queue:')) {

@cosmastech
Copy link
Contributor

Would it make sense to throw an exception in the queue pausing commands if this static property is set to false?

@jackbayliss
Copy link
Contributor Author

jackbayliss commented Nov 30, 2025

@cosmastech Yeah, I think that makes sense 🙂

Didn't want to do too much just incase there's no interest in this, But I'll have a poke, thank you 🙏

Edit: I've poked it, but won't add them for now to prevent any scope creep, but happy for either of us / anyone to add them if this is merged / if Taylor likes the idea.

@jackbayliss
Copy link
Contributor Author

@rodrigopedra Nice one- yeah not sure. I might still try this PR just out of interest as extending it feels awkward I guess. Thank you 🙏

@jackbayliss jackbayliss marked this pull request as ready for review December 1, 2025 10:33
@taylorotwell taylorotwell merged commit e9a3727 into laravel:12.x Dec 1, 2025
74 checks passed
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