mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-22 05:11:55 +01:00
[Perf] GramJs: Fix memory leaks (#1546)
This commit is contained in:
parent
03b8698856
commit
a31aa31b6b
@ -1,6 +1,6 @@
|
||||
const MessageContainer = require('../tl/core/MessageContainer');
|
||||
const TLMessage = require('../tl/core/TLMessage');
|
||||
const BinaryWriter = require('../extensions/BinaryWriter');
|
||||
const BinaryWriter = require('./BinaryWriter');
|
||||
|
||||
const USE_INVOKE_AFTER_WITH = [
|
||||
'messages.SendMessage', 'messages.SendMedia', 'messages.SendMultiMedia',
|
||||
@ -35,11 +35,10 @@ class MessagePacker {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this._queue.push(state);
|
||||
this.setReady(true);
|
||||
|
||||
if (state) {
|
||||
// 1658238041=MsgsAck, we don't care about MsgsAck here because they never resolve anyway.
|
||||
if (state && state.request.CONSTRUCTOR_ID !== 1658238041) {
|
||||
this._pendingStates.push(state);
|
||||
state.promise
|
||||
// Using finally causes triggering `unhandledrejection` event
|
||||
|
@ -338,6 +338,9 @@ class MTProtoSender {
|
||||
const ack = new RequestState(new MsgsAck({ msgIds: Array(...this._pending_ack) }));
|
||||
this._send_queue.append(ack);
|
||||
this._last_acks.push(ack);
|
||||
if (this._last_acks.length >= 10) {
|
||||
this._last_acks.shift();
|
||||
}
|
||||
this._pending_ack.clear();
|
||||
}
|
||||
this._log.debug(`Waiting for messages to send...${this._reconnecting}`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user