[13.x] Skip batches that cannot be retried in queue:retry-batch

Merged
XU
25d ago
+100-4

php artisan queue:retry-batch 9c1e4a2f-wrong

ERROR Unable to find a batch with ID [9c1e4a2f-wrong].
Pushing failed queue jobs of the batch [9c1e4a2f-wrong] back onto the queue.

ErrorException: Attempt to read property "failedJobIds" on null

The error is printed, then the loop carries on into the batch it just said it couldn't find. This is easy to hit since queue:prune-batches removes batches after a day, so an ID copied from a dashboard yesterday is often already gone.

Before #52873 both error branches returned early with exit code 1. That got lost when support for multiple IDs was added. This skips to the next ID instead and returns a failure exit code again.

--isolated was broken by the same PR and fails with Array to string conversion, because the mutex name is built from the id argument, which is now an array. The IDs are joined into a string.