Bird
0
0

If you invoke a Celery task function directly like send_notification() instead of send_notification.delay(), what is the outcome?

medium📝 component behavior Q5 of 15
Django - Celery and Background Tasks
If you invoke a Celery task function directly like send_notification() instead of send_notification.delay(), what is the outcome?
AThe task runs immediately and synchronously in the current process
BThe task is queued and executed asynchronously by a worker
CAn error is raised because delay() is required
DThe task is scheduled but never executed
Step-by-Step Solution
Solution:
  1. Step 1: Understand direct call behavior

    Calling the task function directly executes it immediately in the current process, not asynchronously.
  2. Step 2: Contrast with delay()

    Using delay() sends the task to the queue for asynchronous execution by workers.
  3. Final Answer:

    The task runs immediately and synchronously in the current process -> Option A
  4. Quick Check:

    Direct call runs task synchronously [OK]
Quick Trick: Direct calls run tasks synchronously, use .delay() for async [OK]
Common Mistakes:
MISTAKES
  • Assuming direct calls queue the task asynchronously
  • Expecting an error without using delay()
  • Confusing synchronous execution with asynchronous queuing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes