scheduled_email: Only call .save() if necessary.

Calling `email.save()` is only needed if we altered `email.address`;
it is unnecessary if we called `email.users.add(...)` which will have
done its own INSERT.
This commit is contained in:
Alex Vandiver
2021-08-17 03:24:16 +00:00
committed by Tim Abbott
parent d4f6b93859
commit 56344e4765
3 changed files with 3 additions and 3 deletions

View File

@@ -774,7 +774,7 @@ class LoginTest(ZulipTestCase):
with queries_captured() as queries, cache_tries_captured() as cache_tries: with queries_captured() as queries, cache_tries_captured() as cache_tries:
self.register(self.nonreg_email("test"), "test") self.register(self.nonreg_email("test"), "test")
# Ensure the number of queries we make is not O(streams) # 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 # 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 related # seem to be any O(N) behavior. Some of the cache hits are related

View File

@@ -771,7 +771,7 @@ class QueryCountTest(ZulipTestCase):
acting_user=None, acting_user=None,
) )
self.assert_length(queries, 84) self.assert_length(queries, 82)
self.assert_length(cache_tries, 27) self.assert_length(cache_tries, 27)
peer_add_events = [event for event in events if event["event"].get("op") == "peer_add"] peer_add_events = [event for event in events if event["event"].get("op") == "peer_add"]