fix: send message properly (#3692)
* fix: remove high cpu consumption by adding waiting for message logic Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com> * refactor: use already defined msg id * refactor: use optional arg for waiting for msg ack
This commit is contained in:
parent
ecb50450b7
commit
bd677a8a66
1 changed files with 12 additions and 4 deletions
|
|
@ -326,10 +326,11 @@ exports.LoadUtils = () => {
|
|||
return msg;
|
||||
}
|
||||
|
||||
await window.Store.SendMessage.addAndSendMsgToChat(chat, message);
|
||||
await window.Store.HistorySync.sendPeerDataOperationRequest(3, {
|
||||
chatId: chat.id
|
||||
});
|
||||
const [msgPromise, sendMsgResultPromise] = window.Store.SendMessage.addAndSendMsgToChat(chat, message);
|
||||
await msgPromise;
|
||||
|
||||
if (options.waitUntilMsgSent) await sendMsgResultPromise;
|
||||
|
||||
return window.Store.Msg.get(newMsgKey._serialized);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue