Repository navigation
Upgrade queue to 4 - #13809
Upgrade queue to 4#13809
Conversation
| return new Redis( | ||
| receive: new Connection(...$connection), | ||
| commands: new Locking(new Connection(...$connection)), |
There was a problem hiding this comment.
This changes the production connection lifecycle so blocking receives use a separate connection from heartbeat and recovery commands, but no observable regression test covers that behavior. The changed unit-test fake only mirrors Queue v4's Consumer::receive() signature and returns an empty batch, while the existing concurrency tests reuse one in-memory connection for both broker roles and bypass this factory. This violates the repository directive to test observable behavior instead of mirroring source interfaces. Before merging, add an integration or E2E test that blocks receive and verifies heartbeat or expired-claim recovery through the separate command connection; otherwise the stranded-job failure targeted by this change can return undetected.
Context Used: Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: app/worker.php
Line: 94-96
Comment:
**Recovery Behavior Is Untested**
This changes the production connection lifecycle so blocking receives use a separate connection from heartbeat and recovery commands, but no observable regression test covers that behavior. The changed unit-test fake only mirrors Queue v4's `Consumer::receive()` signature and returns an empty batch, while the existing concurrency tests reuse one in-memory connection for both broker roles and bypass this factory. This violates the repository directive to test observable behavior instead of mirroring source interfaces. Before merging, add an integration or E2E test that blocks receive and verifies heartbeat or expired-claim recovery through the separate command connection; otherwise the stranded-job failure targeted by this change can return undetected.
**Context Used:** Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after) |

Upgrade
utopia-php/queueto 4.0.0 for the unified batch receive API and Redis claim recovery, and Platform to 1.0.0-rc22 to allow queue 4. The lockfile changes only these two packages.Workers now create a dedicated receive connection and a separate locked command connection for each consumer. With the old shared publisher pool, an idle blocking receive could occupy the only resource and prevent maintenance from recovering stranded jobs. The new connections use the existing Redis host, port, username, and password settings. Update the two queue test doubles to the new interfaces.
Validation
With the released dependencies installed:
Real Redis 7 with ACL username/password: exercised the production consumer factory and unmodified Swoole maintenance scheduler. An expired claim older than the default 90,000-second recovery guard was recovered during an otherwise idle blocking receive after 30.07 seconds; exactly one message handled, no errors, processing list empty.
The recovery age remains the library default (25 hours since publication). Each active queue consumer uses two dedicated Redis connections in addition to publisher pool usage.
Platform prerequisite: utopia-php/monorepo#314, released in https://github.com/utopia-php/platform/releases/tag/1.0.0-rc22.