Repository navigation
chore(queue): move to utopia-php/queue 3.0 - #13762
Merged
Merged
Conversation
The major adds rightPopMany() and incrementBy() to Connection, which is the whole of its breaking surface here: InMemoryConnection is the only implementation in this repository, and WorkerConcurrencyTest drives it. Consumer is unchanged, so FakeConsumer in InitJobsTest needs nothing. 3.0 brings PermanentFailure (a handler can end a message's life rather than spend its whole redelivery budget on work that cannot succeed), a pluggable envelope codec, and batched receive -- none of which this commit takes up. It moves the floor so applications built on server-ce can. The lock is not updated yet: utopia-php/platform 1.0.0-rc20 caps queue at ^2.0.0, so this needs rc21 (utopia-php/monorepo#301) first.
platform rc20 caps queue at ^2.0.0, so the major could not resolve through it. rc21 widens that and passes a job spec's batch size through to Server::job(), which is what makes batched receive reachable from an application at all.
Contributor
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Review flagged rightPopMany() for ignoring $timeout. It does, as every pop in this fake does -- nothing here blocks, an empty pop yields, and that is what keeps a busy receive loop from starving the handlers it shares a thread with. Making one method block would be a new behaviour, not a fix. The real defect underneath was quieter: each message after the first went back through pop(), so a batch shorter than asked ended on a yield the real connection never takes. LMPOP waits for the first message only and takes the company it finds. The rest now comes straight off the list. A batch the fake cannot serve looks exactly like an idle queue, so the failure it would cause is silence. The test claims a three-message backlog in one receive and asserts the order and the drained queue -- seen red against a rightPopMany() that returns nothing.
The previous test's subject was the fake itself -- it drove receiveBatch() directly and asserted the broker's return. Review called that implementation-coupled and it is: a test whose subject is a fixture proves the fixture, not the worker. What matters about batching here is the boundary between queues. Batching changes how many messages one receive claims, not how many run at once, so the way it could go wrong is by occupying slots another queue is serialised by, or by losing or duplicating what it claimed. The combined -mode case now runs its parallel sibling batched and asserts what came out: every message once, databases still serial, the cap still the cap. Worth knowing what this cannot see: a batch size that is ignored outright behaves identically at this boundary, because the whole point of a batch is fewer round trips and nothing else. Claiming is not observable from out here.
ChiragAgg5k
approved these changes
Sep 18, 2026
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.
Moves the queue floor to 3.0.0, and platform to
1.0.0-rc21with it.Why platform moves too
platform
1.0.0-rc20requires queue^2.0.0, so the major cannot resolve through it. rc21 (utopia-php/monorepo#301) widens that constraint and passes a job spec'sbatchthrough toServer::job()— without it the batch parameter is unreachable from any application, since every worker boots throughPlatform::initWorker().The breaking surface here
queue 3.0 adds
rightPopMany()andincrementBy()toConnection.tests/extensions/Queue/InMemoryConnection.phpis the only implementation in this repository and now carries both.Consumeris unchanged, soFakeConsumerinInitJobsTestneeded nothing.Nothing in
src/orapp/implements either interface —app/init/registers.phpconstructsConnection\\RedisandBroker\\Redis, both of which the package ships.What 3.0 brings that this does not yet use
PermanentFailure(a handler ends a message's life instead of spending its whole redelivery budget on work that cannot succeed), a pluggable envelope codec with the format named in aContent-Typeheader, and batched receive — one BLMPOP for the wait and the batch. This commit moves the floor so applications built on server-ce can take them up; appwrite/cloud is the first.Verification
WorkerConcurrencyTest(the suite that drivesInMemoryConnection) — 3 tests, 8 assertions, green against 3.0.0 on PHP 8.5 with Swoole.tests/unit/Workers/InitJobsTest.php— 2 tests, 5 assertions, green.tests/extensions/Queue,app/init/registers.php,app/worker.php.