settings: Remove now-unnecessary EMAIL_DELIVERER_DISABLED setting.

This commit is contained in:
Alex Vandiver
2021-05-17 16:14:53 -07:00
committed by Tim Abbott
parent 1e67e0f218
commit 670c7e7ba4
4 changed files with 2 additions and 36 deletions

View File

@@ -1,5 +1,4 @@
# Library code for use in management commands
import signal
from argparse import ArgumentParser, RawTextHelpFormatter
from typing import Any, Dict, List, Optional
@@ -31,11 +30,6 @@ def check_config() -> None:
raise CommandError(f"Error: You must set {setting_name} in /etc/zulip/settings.py.")
def sleep_forever() -> None:
while True: # nocoverage
signal.pause()
class ZulipBaseCommand(BaseCommand):
# Fix support for multi-line usage

View File

@@ -3,11 +3,7 @@ Send email messages that have been queued for later delivery by
various things (at this time invitation reminders and day1/day2
followup emails).
This management command is run via supervisor. Do not run on multiple
machines, as you may encounter multiple sends in a specific race
condition. (Alternatively, you can set `EMAIL_DELIVERER_DISABLED=True`
on all but one machine to make the command have no effect.)
This management command is run via supervisor.
"""
import logging
import time
@@ -19,7 +15,6 @@ from django.db import transaction
from django.utils.timezone import now as timezone_now
from zerver.lib.logging_util import log_to_file
from zerver.lib.management import sleep_forever
from zerver.lib.send_email import EmailNotDeliveredException, deliver_scheduled_emails
from zerver.models import ScheduledEmail
@@ -38,10 +33,6 @@ Usage: ./manage.py deliver_scheduled_emails
"""
def handle(self, *args: Any, **options: Any) -> None:
if settings.EMAIL_DELIVERER_DISABLED:
sleep_forever()
while True:
found_rows = False
with transaction.atomic():

View File

@@ -10,7 +10,6 @@ from django.utils.timezone import now as timezone_now
from zerver.lib.actions import build_message_send_dict, do_send_messages
from zerver.lib.logging_util import log_to_file
from zerver.lib.management import sleep_forever
from zerver.lib.message import SendMessageRequest
from zerver.models import Message, ScheduledMessage, get_user_by_delivery_email
@@ -23,10 +22,7 @@ class Command(BaseCommand):
help = """Deliver scheduled messages from the ScheduledMessage table.
Run this command under supervisor.
This management command is run via supervisor. Do not run on multiple
machines, as you may encounter multiple sends in a specific race
condition. (Alternatively, you can set `EMAIL_DELIVERER_DISABLED=True`
on all but one machine to make the command have no effect.)
This management command is run via supervisor.
Usage: ./manage.py deliver_scheduled_messages
"""
@@ -57,14 +53,6 @@ Usage: ./manage.py deliver_scheduled_messages
def handle(self, *args: Any, **options: Any) -> None:
try:
if settings.EMAIL_DELIVERER_DISABLED:
# Here doing a check and sleeping indefinitely on this setting might
# not sound right. Actually we do this check to avoid running this
# process on every server that might be in service to a realm. See
# the comment in zproject/default_settings.py file about renaming this
# setting.
sleep_forever()
while True:
with transaction.atomic():
messages_to_deliver = ScheduledMessage.objects.filter(

View File

@@ -326,13 +326,6 @@ REGISTER_LINK_DISABLED: Optional[bool] = None
LOGIN_LINK_DISABLED = False
FIND_TEAM_LINK_DISABLED = True
# Controls if the server should run certain jobs like deliver_scheduled_emails or
# deliver_scheduled_messages. This setting in long term is meant for
# handling jobs for which we don't have a means of establishing a locking
# mechanism that works with multiple servers running these jobs.
# TODO: We should rename this setting so that it reflects its purpose actively.
EMAIL_DELIVERER_DISABLED = False
# What domains to treat like the root domain
# "auth" is by default a reserved subdomain for the use by python-social-auth.
ROOT_SUBDOMAIN_ALIASES = ["www", "auth"]