Open adi- opened 4 years ago
Meanwhile, I'll try to use TASK_SOFT_TIME_LIMIT
.
Meanwhile, I'll try to use
TASK_SOFT_TIME_LIMIT
.
Ok, nice. Above is working like a charm. Btw, my error with celery was Cannot reach CELERY_EMAIL_BACKEND django
. I guess it would be wise to mention in django-celery-email
's docs, that it is recommended to set TASK_SOFT_TIME_LIMIT
.
Sometimes worker is stuck on executing email tasks (probably connection problems). To fix this, there is an Celery option
TASK_TIME_LIMIT
where you can limit task execution time (p.s. default value isinfinite
). However, when task hits time limit, worker is killed withSIGKILL
and what I see from logs, the task is not retried for the second time.I am considering to use https://docs.celeryproject.org/en/latest/userguide/configuration.html#task-reject-on-worker-lost, but as docs states, it is probably not the best way to handle this error.
I guess the easiest way would be to handle such error in django-celery-email internally. Or maybe I am missing something?