Revert "home: Don't use pointer to compute furthest_read_time."

This reverts commit 8f32db81a1.

This change unfortunately requires an index that we don't have, and
thus is incredibly expensive.  We'll need to do a thoughtful reworking
before we can integrate it again.
This commit is contained in:
Tim Abbott
2020-04-27 22:29:08 -07:00
parent 1094589f79
commit 976e554799
3 changed files with 9 additions and 20 deletions

View File

@@ -13,7 +13,7 @@ from zerver.forms import ToSForm
from zerver.models import Message, Stream, UserProfile, \
Realm, UserMessage, \
PreregistrationUser, \
get_latest_read_usermessage
get_usermessage_by_message_id
from zerver.lib.events import do_events_register
from zerver.lib.actions import do_change_tos_version, \
realm_user_count
@@ -223,7 +223,10 @@ def home_real(request: HttpRequest) -> HttpResponse:
register_ret['pointer'] = register_ret['max_message_id']
furthest_read_time = None
else:
latest_read = get_latest_read_usermessage(user_profile)
latest_read = get_usermessage_by_message_id(user_profile, user_profile.pointer)
if latest_read is None:
# Don't completely fail if your saved pointer ID is invalid
logging.warning("User %s has invalid pointer %s" % (user_profile.id, user_profile.pointer))
furthest_read_time = sent_time_in_epoch_seconds(latest_read)
# We pick a language for the user as follows: