Don't resend automatically group chat messages
Since we fixed re-sending of messages, it has been noticed a performance degradation in private group chats. This is due to too aggressive re-sending of messages. This commit disables resending of private group chat messages for now (same as 1.9, so no changes), but keeps it enabled for 1-to-1s.
This commit is contained in:
parent
cd21f9b0e2
commit
4084c9d82c
|
@ -1216,11 +1216,10 @@ func (m *Messenger) CreateGroupChatWithMembers(ctx context.Context, name string,
|
|||
m.allChats[chat.ID] = &chat
|
||||
|
||||
_, err = m.dispatchMessage(ctx, common.RawMessage{
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
ResendAutomatically: true,
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@ -1299,11 +1298,10 @@ func (m *Messenger) RemoveMemberFromGroupChat(ctx context.Context, chatID string
|
|||
return nil, err
|
||||
}
|
||||
_, err = m.dispatchMessage(ctx, common.RawMessage{
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: oldRecipients,
|
||||
ResendAutomatically: true,
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: oldRecipients,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -1388,11 +1386,10 @@ func (m *Messenger) AddMembersToGroupChat(ctx context.Context, chatID string, me
|
|||
return nil, err
|
||||
}
|
||||
_, err = m.dispatchMessage(ctx, common.RawMessage{
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
ResendAutomatically: true,
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@ -1453,11 +1450,10 @@ func (m *Messenger) ChangeGroupChatName(ctx context.Context, chatID string, name
|
|||
return nil, err
|
||||
}
|
||||
_, err = m.dispatchMessage(ctx, common.RawMessage{
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
ResendAutomatically: true,
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@ -1664,11 +1660,10 @@ func (m *Messenger) AddAdminsToGroupChat(ctx context.Context, chatID string, mem
|
|||
return nil, err
|
||||
}
|
||||
_, err = m.dispatchMessage(ctx, common.RawMessage{
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
ResendAutomatically: true,
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@ -1732,11 +1727,10 @@ func (m *Messenger) ConfirmJoiningGroup(ctx context.Context, chatID string) (*Me
|
|||
return nil, err
|
||||
}
|
||||
_, err = m.dispatchMessage(ctx, common.RawMessage{
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
ResendAutomatically: true,
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -1800,11 +1794,10 @@ func (m *Messenger) LeaveGroupChat(ctx context.Context, chatID string, remove bo
|
|||
return nil, err
|
||||
}
|
||||
_, err = m.dispatchMessage(ctx, common.RawMessage{
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
ResendAutomatically: true,
|
||||
LocalChatID: chat.ID,
|
||||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE,
|
||||
Recipients: recipients,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue