mirror of https://github.com/zulip/zulip.git
update_first_visible_message_id: Use Message.realm column.
With the Message.realm column added, this query can now be improved.
This commit is contained in:
parent
925fa4ca50
commit
601f0677f3
|
@ -1437,7 +1437,7 @@ def update_first_visible_message_id(realm: Realm) -> None:
|
|||
else:
|
||||
try:
|
||||
first_visible_message_id = (
|
||||
Message.objects.filter(sender__realm=realm)
|
||||
Message.objects.filter(realm=realm)
|
||||
.values("id")
|
||||
.order_by("-id")[realm.message_visibility_limit - 1]["id"]
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue