I am perplexed with this error and looking for some expert help. Here are the details -
- I am running a Django application with celery to schedule and execute tasks
- I use Azure Cache for Redis as the celery backend and broker
- Azure Redis has SSL port enabled and non-SSL port disabled
- I have configured SSL using URL scheme (
rediss://) as well as celery config (broker_use_sslandredis_backend_use_ssl) - My Task is defined in one django app and the view is in another (though they are deployed together)
- Everything works also fine in my local setup, where I don't use SSL on redis
- My django server is running with gunicorn inside a docker container
Everything works just fine when celery-beat schedules a task and workers pick them up to execute. They both are able to communicate with Redis fine.
However, when I call a task from my django view directly, with delay function, I see a timeout error on connecting Redis.
Here is how I am calling the task (removed some boilerplate code for brevity):
from mydjangoapp import tasks
def MyViewFunction(request):
tasks.MyTask.delay(param1, param2, param3)
Here is the error I see :
kombu.exceptions.OperationalError: Error while reading from <my-redis-server-url>:6380: ('timed out',)
Can someone please point out what happens differently when I call task.delay() from django view than celery workers?
Not sure if I missed any important detail. Please let me know and will update it in the Question. Thanks.