Preventing Duplicate Background Jobs in Celery with Redis: A Production Pattern

A user double-clicks “Generate Study Plan”. Two parallel Celery workers start processing the same project simultaneously, doubling OpenAI costs and writing duplicate Q&A pairs to the database. Here’s how to fix it with a Redis index key , and why TTL alone isn’t enough.