I've just started work on a project that uses Django & Celery. I'm quite new to both. One of the endpoints has code that looks like this:
task_do_something.delay()
return Response(
{"success": True},
status=status.HTTP_200_OK
)
task_do_something is a task that takes a while to complete. (It does not call any other Celery tasks.) Will the main process execute the return statement immediately after Celery queues the task? Or will it wait for the task to be complete before moving on to the next line?
Reading through the documentation, I'm inclined to think that the answer would be the first option (execute next statement after the task is queued), because Celery tasks are asynchronous. But I'd like to double-check.