Add config for celery email task soft time (#8887)

This commit is contained in:
Hossein Torabi
2020-01-04 10:50:57 +03:30
committed by Ville Brofeldt
parent 6537d5ed8c
commit 478e445a5a
2 changed files with 9 additions and 1 deletions

View File

@@ -651,6 +651,10 @@ SCHEDULED_EMAIL_DEBUG_MODE = False
# Email reports - minimum time resolution (in minutes) for the crontab
EMAIL_REPORTS_CRON_RESOLUTION = 15
# The MAX duration (in seconds) a email schedule can run for before being killed
# by celery.
EMAIL_ASYNC_TIME_LIMIT_SEC = 300
# Email report configuration
# From address in emails
EMAIL_REPORT_FROM_ADDRESS = "reports@superset.org"

View File

@@ -346,7 +346,11 @@ def deliver_slice(schedule):
_deliver_email(schedule, subject, email)
@celery_app.task(name="email_reports.send", bind=True, soft_time_limit=300)
@celery_app.task(
name="email_reports.send",
bind=True,
soft_time_limit=config["EMAIL_ASYNC_TIME_LIMIT_SEC"],
)
def schedule_email_report(
task, report_type, schedule_id, recipients=None
): # pylint: disable=unused-argument