Skip to content

Release v0.5.1 - Task Deduplication Fix

Latest

Choose a tag to compare

@guglielmo guglielmo released this 25 Oct 08:50

🐛 Bug Fixes

Critical: Fix duplicate task scheduling issue

Resolves a critical issue where tasks could be scheduled multiple times in Redis Queue, leading to duplicate executions. This occurred after stack restarts, CI/CD deployments, or manual task re-activation.

What's Fixed

  • Deduplication Logic: RQTaskQueueService now checks for existing scheduled jobs before creating new ones
  • Automatic Cleanup: Old scheduled jobs are automatically cancelled before creating new schedules
  • Graceful Error Handling: Properly handles orphaned job IDs (jobs that no longer exist in Redis)
  • Comprehensive Logging: Added warning/info/debug messages for tracking deduplication events

🧪 Testing

Added 6 comprehensive test cases covering all deduplication scenarios:

  • Normal scheduling without existing jobs
  • Cancellation of existing valid jobs
  • Graceful handling of orphaned jobs
  • Periodic task deduplication
  • Multiple rapid re-scheduling attempts
  • Immediate execution with orphaned job cleanup

All 80 tests pass (74 existing + 6 new)

📚 Documentation

  • README.md: Added Development and Testing section with instructions for running tests
  • CLAUDE.md: Added comprehensive documentation for AI assistant context

🔧 Technical Details

The deduplication logic prevents the following scenario:

  1. Task scheduled with job_id "abc123"
  2. Stack restarts or task is re-activated
  3. New job_id "xyz789" created
  4. ❌ Old job "abc123" remains in Redis → duplicate execution

Now properly handled with automatic cancellation of old jobs before creating new ones.

📦 Installation

pip install --upgrade django-eztaskmanager

🙏 Credits

This release includes contributions from Claude Code for deduplication logic implementation and comprehensive test coverage.