Repository navigation
fix(queue): drop the retried job's old payload when retry() requeues it - #14524
Conversation
|
Review complete. No blocking issues — 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
This small PR touches the queue package's Redis broker, adjusting the
Reviewed commit: 931cd0f |
🔵 Tier A · Mergeable after minor fixes
Redis retry now moves failed jobs to the ready or dead list through a Lua script that checks the current failed-list tail and performs the transition with old-payload cleanup. Failed entries whose payload is missing are removed, while entries with payloads that the codec cannot decode are retained on the dead list for inspection. Latest changes: The newest commits couple failed-list removal with requeueing or dead-lettering, guard the transition against a changed tail entry, and validate destination list types before mutation.
Fix with agent prompt### Issue 1
packages/queue/src/Broker/Redis.php:523-526
**Assert retry removes the old payload**
The existing `RedisBrokerRecoveryTest::testRetryRequeuesARejectedMessageWithItsAttemptCount` verifies the replacement is readable, but not that the original `jobs.*.<pid>` key is gone. A regression that omits this deletion would still pass the current retry coverage.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.📂 Walkthrough · 2
⏳ Still open from earlier reviews · 1
Merged |
| $this->script($this->commands, 'requeue', [ | ||
| "{$queue->namespace}.queue.{$queue->name}", | ||
| "{$queue->namespace}.jobs.{$queue->name}.{$pid}", | ||
| ], [$this->retryPayload($queue, $job)]); |
There was a problem hiding this comment.
Assert retry removes the old payload
The existing RedisBrokerRecoveryTest::testRetryRequeuesARejectedMessageWithItsAttemptCount verifies the replacement is readable, but not that the original jobs.*.<pid> key is gone. A regression that omits this deletion would still pass the current retry coverage.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/queue/src/Broker/Redis.php
Line: 523-526
Comment:
**Assert retry removes the old payload**
The existing `RedisBrokerRecoveryTest::testRetryRequeuesARejectedMessageWithItsAttemptCount` verifies the replacement is readable, but not that the original `jobs.*.<pid>` key is gone. A regression that omits this deletion would still pass the current retry coverage.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · testing · Reply if this doesn't apply.
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
# Conflicts: # packages/queue/src/Broker/Redis.php
Broker\Redis::retry()requeued each failed job under a fresh pid but left the payload under the old pid (<namespace>.jobs.<queue>.<pid>). Nothing references that pid once it leaves the failed list, and with the defaultjobTtlof 0 it never expires, so everyqueue-retryrun grew Redis memory by one payload per retried job.retry.luanow takes the old payload key as an optional third key and deletes it in the same atomic step that moves the job from the failed list to the ready queue, asreclaim.luaalready does forreap(). Payloads of jobs parked on the dead list are kept, since the dead list still references them.A failed job whose stored payload the codec cannot decode is now parked on the dead list instead of having its pid dropped and its payload orphaned.
Verified:
retry.luaagainst Redis 7: requeue removes the old payload, parking keeps it, an expired entry is dropped from the failed list, a stale pid is a no-opCloses #14491