Stub the full Queue Pause/Resume surface on QueueFactory - #4683
Merged
Conversation
Flarum's QueueFactory stands in for Illuminate's full QueueManager, but only implemented part of the manager-level Queue Pause/Resume API. Each Illuminate release that wires up another pause method on the worker has crashed the queue with "Call to undefined method" — first isPaused(), then getPausedQueues() (#4673) — silently breaking queued notifications and mail. Stub the whole family as no-ops so the worker can't crash on the next addition: - Add pause(), pauseFor(), resume() and withoutInterruptionPolling(). - Fix getPausedQueues() to take ($connection, $queues), matching the QueueManager contract and the Worker's actual call (it previously only worked because PHP drops extra positional arguments). Queue pausing itself remains unsupported for now; it is planned for a future Flarum version.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Flarum's
QueueFactoryis bound as the'queue'/Factoryservice and handed to Illuminate'sWorkerin the role normally filled by the fullQueueManager. But theFactorycontract only guaranteesconnection()— every other method the worker or queue commands call on the manager is somethingQueueFactoryhas to provide itself.Illuminate's Queue Pause/Resume feature keeps growing that manager-level surface, and
QueueFactoryhas been catching up only after each one breaks production:isPaused()had to be added when the worker started calling it.getPausedQueues()had to be added in [2.x] Add getPausedQueues() to QueueFactory for illuminate/queue v13.11+ compatibility #4673 whenilluminate/queuev13.11's worker began calling it, crashing the queue with «Call to undefined method» and silently breaking all queued notifications and mail.Both methods live on
QueueManager, not on the queue connection, so there's no general fallback protecting us — the next pause method wired into the worker will break things the same way.What this does
Stubs the whole Queue Pause/Resume family up front, so a future Illuminate release calling any of them can't crash the worker:
pause(),pauseFor(),resume()andwithoutInterruptionPolling().getPausedQueues()to take($connection, $queues), matching theQueueManagercontract and the worker's actual call — it previously only worked because PHP silently drops extra positional arguments.: boolreturn type to the existingisPaused()for consistency.Signatures mirror
Illuminate\Queue\QueueManager. Queue pausing itself remains unsupported for now — these are deliberate no-ops — but it is planned for a future Flarum version, noted with aTODO.Notes
A generic
__call()forwarding to the connection (likeQueueManagerhas) was considered and rejected: it would not have prevented either past crash, because the pause methods don't exist on the queue connection either. Explicitly stubbing the bounded manager-level family is the targeted fix.