feat: Clean up job IDs from dedup cache when resultTTL expires#37
Merged
feat: Clean up job IDs from dedup cache when resultTTL expires#37
Conversation
Job entries in the jobs hash previously persisted forever, even after
the result/error TTL expired. This meant a completed job's ID could
never be reused. Now deduplication lasts only as long as the result is
cached — once resultTTL expires, the job ID is cleaned up so it can be
re-enqueued.
Uses a companion expiry field ({id}:exp in Redis, #jobExpiry map in
Memory, {id}.ttl file in File) to track when terminal job entries
should expire. On enqueue, if the existing job has expired, it is
deleted and re-enqueue proceeds. The updateResultTTL method also syncs
the dedup expiry when extending the result TTL.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ShogunPanda
approved these changes
Mar 7, 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.
Summary
resultTTLelapses, allowing the same job ID to be re-enqueued after its result has been garbage collected{id}:expin Redis,#jobExpirymap in Memory,{id}.ttlfile in File) to track when terminal job entries should expireupdateResultTTLalso syncs the dedup expiry window when extending result TTLTest plan
getJobStatereturns null after expiryupdateResultTTLtest: expectsnot_foundinstead ofmissing_payloadafter TTL expiry (job state is now cleaned up)🤖 Generated with Claude Code