Skip to content

Stub the full Queue Pause/Resume surface on QueueFactory - #4683

Merged
imorland merged 1 commit into
2.xfrom
im/queue-factory-pause-stubs
Jun 2, 2026
Merged

Stub the full Queue Pause/Resume surface on QueueFactory#4683
imorland merged 1 commit into
2.xfrom
im/queue-factory-pause-stubs

Conversation

@imorland

@imorland imorland commented Jun 2, 2026

Copy link
Copy Markdown
Member

The problem

Flarum's QueueFactory is bound as the 'queue' / Factory service and handed to Illuminate's Worker in the role normally filled by the full QueueManager. But the Factory contract only guarantees connection() — every other method the worker or queue commands call on the manager is something QueueFactory has to provide itself.

Illuminate's Queue Pause/Resume feature keeps growing that manager-level surface, and QueueFactory has been catching up only after each one breaks production:

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:

  • Adds no-op pause(), pauseFor(), resume() and withoutInterruptionPolling().
  • Fixes getPausedQueues() to take ($connection, $queues), matching the QueueManager contract and the worker's actual call — it previously only worked because PHP silently drops extra positional arguments.
  • Adds a : bool return type to the existing isPaused() 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 a TODO.

Notes

A generic __call() forwarding to the connection (like QueueManager has) 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.

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.
@imorland
imorland requested a review from a team as a code owner June 2, 2026 07:28
@imorland imorland added this to the 2.0.0-rc.3 milestone Jun 2, 2026
@imorland
imorland merged commit dd05fbc into 2.x Jun 2, 2026
25 checks passed
@imorland
imorland deleted the im/queue-factory-pause-stubs branch June 2, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant