Django - Celery and Background TasksIn a Django app using Celery with Redis as broker, what happens if Redis server is down when a task is sent?AThe task fails immediately with a connection errorBThe task is queued locally until Redis restartsCThe task is silently dropped without errorDThe task runs synchronously in the main threadCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand Celery behavior with Redis downCelery tries to connect to Redis broker; if Redis is down, connection error occurs immediately.Step 2: Evaluate other optionsCelery does not queue tasks locally or run them synchronously by default; tasks are not silently dropped.Final Answer:The task fails immediately with a connection error -> Option AQuick Check:Redis down causes immediate connection error in Celery [OK]Quick Trick: Redis down causes immediate connection error in Celery [OK]Common Mistakes:MISTAKESAssuming tasks queue locally without RedisThinking tasks run synchronously automaticallyBelieving tasks get silently dropped
Master "Celery and Background Tasks" in Django9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Django Quizzes Async Django - ASGI vs WSGI - Quiz 3easy Caching - Cache framework configuration - Quiz 9hard DRF Advanced Features - Throttling for rate limiting - Quiz 7medium Django REST Framework Basics - Request parsing and response rendering - Quiz 10hard Security Best Practices - Clickjacking protection - Quiz 4medium Security Best Practices - HTTPS and secure cookies - Quiz 10hard Signals - Custom signals - Quiz 14medium Testing Django Applications - TestCase and SimpleTestCase - Quiz 5medium Testing Django Applications - Testing views with Client - Quiz 9hard Testing Django Applications - Coverage reporting - Quiz 2easy