Skip to content

Commit

Permalink
🔥 [#3049] -- delete beat/task to send e-mails
Browse files Browse the repository at this point in the history
django-yubin now uses celery for queuing out of the box, so we no longer
need to simulate cron to actually send out the e-mails.

See https://django-yubin.readthedocs.io/en/latest/install.html\#upgrading-from-previous-versions
which documents the upgrade steps.
  • Loading branch information
sergei-maertens committed Jul 4, 2023
1 parent 711f0ca commit 9b87bc7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
6 changes: 1 addition & 5 deletions src/openforms/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@
#
# Sending EMAIL
#
EMAIL_BACKEND = "django_yubin.smtp_queue.EmailBackend"
EMAIL_BACKEND = "django_yubin.backends.QueuedEmailBackend"
EMAIL_HOST = config("EMAIL_HOST", default="localhost")
EMAIL_PORT = config(
"EMAIL_PORT", default=25
Expand Down Expand Up @@ -674,10 +674,6 @@
# https://docs.celeryproject.org/en/v4.4.7/userguide/periodic-tasks.html#crontab-schedules
"schedule": crontab(minute=0, hour=0),
},
"send-emails": {
"task": "openforms.utils.tasks.send_emails",
"schedule": config("BEAT_SEND_EMAIL_INTERVAL", default=20), # every 20 seconds
},
"retry-submissions-processing": {
"task": "openforms.submissions.tasks.retry_processing_submissions",
"schedule": config("RETRY_SUBMISSIONS_INTERVAL", default=60 * 5),
Expand Down
12 changes: 0 additions & 12 deletions src/openforms/utils/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from django.core import management

from celery_once import QueueOnce

from ..celery import app

logger = logging.getLogger(__name__)
Expand All @@ -16,16 +14,6 @@ def clear_session_store():
management.call_command("clearsessions")


@app.task(
base=QueueOnce,
ignore_result=True,
once={"graceful": True}, # do not spam error monitoring
)
def send_emails() -> None:
logger.debug("Processing e-mail queue")
management.call_command("send_mail")


@app.task(ignore_result=True)
def cleanup_csp_reports() -> None:
logger.debug("Cleanup CSP reports")
Expand Down

0 comments on commit 9b87bc7

Please sign in to comment.