Repository navigation
feat(queue): add TTL retention and purge command for failed jobs - #15752
Harshit-2208 wants to merge 8 commits into
Conversation
Code review
This PR adds configurable TTL retention for failed Redis queue payloads, trims expired failed-list entries during maintenance, and adds Latest changes: The latest commits replace the stale Docker chmod entry, make unsupported NATS purges fail explicitly, allow unfiltered Redis purges to remove corrupt payloads, and add Redis purge regression tests and the remaining publisher test-double implementations. Note @Harshit-2208 does not have write access to this repository, so Hansi does not approve automatically. A maintainer can review and approve. Walkthrough (20)
Merged Tip Comment |
The findings that requested changes are resolved. See the summary comment for what is still open.

What does this PR do?
Adds configurable TTL-based retention and manual purge capabilities for failed queue jobs in Redis to prevent unbounded memory growth over time.
Summary of Changes
_APP_QUEUE_FAILED_TTL):_APP_QUEUE_FAILED_TTLenvironment variable (default604800seconds / 7 days) inapp/config/variables.phpand wired it intoapp/worker.phpviaServer::setJobTtl().Redis::maintain()withtrimFailed()to periodically sweep orphaned PIDs fromutopia-queue.failed.<queue>once their Redis payload keys expire.queue-purgeCLI task (QueuePurge+bin/queue-purge) supporting--name,--older-than(in days), and--limitto delete failed job entries and their payloads without affecting active jobs.--newer-than(in seconds) toqueue-retry(QueueRetry) so operators can selectively re-drive recent failures.Publisher\Synchronouswithpurge()and$newerThanonretry(), updatingRedis,Pool,Background,Nats, andMockPublisher.bin/queue-count-failedwrapper script referencing a non-existentqueue-counttask.Test Plan
php -l) across all modified and added files.queue-purgeandqueue-retry --newer-than.Related PRs and Issues
Checklist