Skip to content

[13.x] Optimize Worker queue pause check#60109

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
jackbayliss:13.x-optimize-queue-pause-check
May 14, 2026
Merged

[13.x] Optimize Worker queue pause check#60109
taylorotwell merged 1 commit into
laravel:13.xfrom
jackbayliss:13.x-optimize-queue-pause-check

Conversation

@jackbayliss
Copy link
Copy Markdown
Contributor

@jackbayliss jackbayliss commented May 13, 2026

As per your feedback here this is targetted at 13.x.

Why

If you have pausing enabled each queue you set will hit the cache 1x every single job, so if you have queue:work --queue=high,default both the high and default queue will have a cache hit every job, do one million jobs and thats 2 million cache hits.

Now, scale it up to 10 workers 2 queues each some even 4, and it can suddenly get crazy... (this is just a staging site)

image

What this does

This changes the getPausedQueues method on the worker to getPausedQueues - this is a B/C but I couldnt see a better way - unless we deprecate the old method and add a new one 🤷🏻

All this PR does is use many(), so we can do one round trip and attempt at making it more performant. This is even more helpful the more queues and workers you have.

This may need tweaking, and a bit of love so hash at it

Secret message : SGVsbG8gTXIgT3R3ZWxs

@github-actions
Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs 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 changed the title [13.x] Optimize queue pause check [13.x] Optimize Worker queue pause check May 13, 2026
and this docblock

Update docblock

array_flip for perf

dont type fam

fix that

test

worker

fix the tests jack

omg how dare u not run the full suite
@jackbayliss jackbayliss force-pushed the 13.x-optimize-queue-pause-check branch from 2f802c4 to e196289 Compare May 13, 2026 14:28
@jackbayliss jackbayliss marked this pull request as ready for review May 13, 2026 16:06
@taylorotwell taylorotwell merged commit 003d650 into laravel:13.x May 14, 2026
52 checks passed
@jackbayliss jackbayliss deleted the 13.x-optimize-queue-pause-check branch May 19, 2026 23:25
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.

2 participants