Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
scheduled_email: Only call .save() if necessary.
Alex Vandiver56344e4765d5
diff --git a/zerver/lib/send_email.py b/zerver/lib/send_email.pyindex 385625d070f..c77585d688f 100644--- a/zerver/lib/send_email.py+++ b/zerver/lib/send_email.py@@ -363,7 +363,7 @@ def send_future_email(assert to_emails is not Noneassert len(to_emails) == 1email.address = parseaddr(to_emails[0])[1]- email.save()+ email.save()except Exception as e:email.delete()raise ediff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.pyindex a6a55afa19d..48d827e7ec3 100644--- a/zerver/tests/test_signup.py+++ b/zerver/tests/test_signup.py@@ -774,7 +774,7 @@ class LoginTest(ZulipTestCase):with queries_captured() as queries, cache_tries_captured() as cache_tries:self.register(self.nonreg_email("test"), "test")# Ensure the number of queries we make is not O(streams)- self.assert_length(queries, 89)+ self.assert_length(queries, 87)# We can probably avoid a couple cache hits here, but there doesn't# seem to be any O(N) behavior. Some of the cache hits are relateddiff --git a/zerver/tests/test_users.py b/zerver/tests/test_users.pyindex 22a02da677d..eaaff09410c 100644--- a/zerver/tests/test_users.py+++ b/zerver/tests/test_users.py@@ -771,7 +771,7 @@ class QueryCountTest(ZulipTestCase):acting_user=None,)- self.assert_length(queries, 84)+ self.assert_length(queries, 82)self.assert_length(cache_tries, 27)peer_add_events = [event for event in events if event["event"].get("op") == "peer_add"]