MessageReceiver: Ensure that we always clearTimeout before set

This commit is contained in:
Scott Nonnenberg 2019-10-21 18:54:40 -07:00
parent c7c8bcc33a
commit 104b694186
2 changed files with 4 additions and 3 deletions

View file

@ -263,6 +263,7 @@ MessageReceiver.prototype.extend({
const ev = new Event('empty');
this.dispatchAndWait(ev);
this.isEmptied = true;
this.maybeScheduleRetryTimeout();
};
@ -393,6 +394,7 @@ MessageReceiver.prototype.extend({
},
maybeScheduleRetryTimeout() {
if (this.isEmptied) {
this.clearRetryTimeout();
this.retryCachedTimeout = setTimeout(() => {
this.pendingQueue.add(() => this.queueAllCached());
}, RETRY_TIMEOUT);
@ -450,7 +452,6 @@ MessageReceiver.prototype.extend({
this.queueEnvelope(item.envelope);
});
this.clearRetryTimeout();
this.maybeScheduleRetryTimeout();
} catch (error) {
items.forEach(item => {

View file

@ -1244,7 +1244,7 @@
"rule": "jQuery-wrap(",
"path": "libtextsecure/message_receiver.js",
"line": " const buffer = dcodeIO.ByteBuffer.wrap(ciphertext);",
"lineNumber": 751,
"lineNumber": 752,
"reasonCategory": "falseMatch",
"updated": "2019-10-21T22:30:15.622Z"
},
@ -1252,7 +1252,7 @@
"rule": "jQuery-wrap(",
"path": "libtextsecure/message_receiver.js",
"line": " const buffer = dcodeIO.ByteBuffer.wrap(ciphertext);",
"lineNumber": 776,
"lineNumber": 777,
"reasonCategory": "falseMatch",
"updated": "2019-10-21T22:30:15.622Z"
},