feat: auto-cleanup DLQ entries when jobs succeed#7
Merged
Conversation
9c1891f to
22882e0
Compare
When a job with a job_key completes successfully, automatically delete any DLQ entries with that same job_key. This prevents the DLQ requeue cron from repeatedly requeuing jobs that have already succeeded. Changes: - Add `delete_dlq_by_job_key()` method to BackfillClient - Add `DlqCleanupPlugin` that hooks into job completion - Auto-register the plugin when DLQ processor is enabled The cleanup is automatic and transparent - users don't need to change anything. When DLQ is enabled, the cleanup plugin is automatically added to the worker. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
22882e0 to
3ec8783
Compare
ceejbot
approved these changes
Dec 19, 2025
Owner
ceejbot
left a comment
There was a problem hiding this comment.
Heck YEAH the lifecycle hooks are working out nicely!
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
When a job with a
job_keycompletes successfully, automatically delete any DLQ entries with that samejob_key. This prevents the DLQ requeue cron from repeatedly requeuing jobs that have already succeeded.Problem
Previously, when a job was requeued from DLQ and then succeeded:
requeued_countincrementedSolution
delete_dlq_by_job_key()method toBackfillClientDlqCleanupPluginthat implementsLifecycleHookson_job_complete, check if job has ajob_keyand delete matching DLQ entriesChanges
src/client/dlq.rs: Adddelete_dlq_by_job_key()methodsrc/dlq_cleanup_plugin.rs: New file withDlqCleanupPluginsrc/worker.rs: Auto-register cleanup plugin when DLQ is enabledsrc/lib.rs: ExportDlqCleanupPluginTest plan
🤖 Generated with Claude Code