mirror of https://github.com/zulip/zulip.git
update_message_backend: Log number of changed messages.
This will be helpful for debugging potential performance problems.
This commit is contained in:
parent
929e8a48d7
commit
0f7f9dc0fb
|
@ -2748,7 +2748,7 @@ def do_update_embedded_data(user_profile, message, content, rendered_content):
|
|||
# We use transaction.atomic to support select_for_update in the attachment codepath.
|
||||
@transaction.atomic
|
||||
def do_update_message(user_profile, message, subject, propagate_mode, content, rendered_content):
|
||||
# type: (UserProfile, Message, Optional[Text], str, Optional[Text], Optional[Text]) -> None
|
||||
# type: (UserProfile, Message, Optional[Text], str, Optional[Text], Optional[Text]) -> int
|
||||
event = {'type': 'update_message',
|
||||
'sender': user_profile.email,
|
||||
'message_id': message.id} # type: Dict[str, Any]
|
||||
|
@ -2851,6 +2851,7 @@ def do_update_message(user_profile, message, subject, propagate_mode, content, r
|
|||
'flags': um.flags_list()
|
||||
}
|
||||
send_event(event, list(map(user_info, ums)))
|
||||
return len(changed_messages)
|
||||
|
||||
def encode_email_address(stream):
|
||||
# type: (Stream) -> Text
|
||||
|
|
|
@ -941,7 +941,10 @@ def update_message_backend(request, user_profile,
|
|||
user_profile.realm)
|
||||
links_for_embed |= message.links_for_preview
|
||||
|
||||
do_update_message(user_profile, message, subject, propagate_mode, content, rendered_content)
|
||||
number_changed = do_update_message(user_profile, message, subject,
|
||||
propagate_mode, content, rendered_content)
|
||||
# Include the number of messages changed in the logs
|
||||
request._log_data['extra'] = "[%s]" % (number_changed,)
|
||||
if links_for_embed and getattr(settings, 'INLINE_URL_EMBED_PREVIEW', None):
|
||||
event_data = {
|
||||
'message_id': message.id,
|
||||
|
|
Loading…
Reference in New Issue