From 3bae3cd54d3d9cbc4214ed05aeffac784ea7aace Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 12 Aug 2016 19:24:45 -0700 Subject: [PATCH] settings: Add option to disable email deliverer. --- zerver/management/commands/deliver_email.py | 6 ++++++ zproject/settings.py | 1 + 2 files changed, 7 insertions(+) diff --git a/zerver/management/commands/deliver_email.py b/zerver/management/commands/deliver_email.py index 4fbc30f094..091679618c 100755 --- a/zerver/management/commands/deliver_email.py +++ b/zerver/management/commands/deliver_email.py @@ -72,6 +72,12 @@ Usage: python manage.py deliver_email def handle(self, *args, **options): # TODO: this only acquires a lock on the system, not on the DB: # be careful not to run this on multiple systems. + + # In the meantime, we have an option to prevent this job from + # running on >1 machine + if settings.EMAIL_DELIVERER_DISABLED: + return + with lockfile("/tmp/zulip_email_deliver.lockfile"): while True: # make sure to use utcnow, otherwise it gets confused when you set the time with utcnow(), diff --git a/zproject/settings.py b/zproject/settings.py index f1a6024fe2..7af168c3d0 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -144,6 +144,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '', 'ENABLE_FEEDBACK': PRODUCTION, 'FEEDBACK_EMAIL': None, 'WELCOME_EMAIL_SENDER': None, + 'EMAIL_DELIVERER_DISABLED': False, 'ENABLE_GRAVATAR': True, 'DEFAULT_AVATAR_URI': '/static/images/default-avatar.png', 'AUTH_LDAP_SERVER_URI': "",