diff --git a/modules/xmpp/ResumeTask.js b/modules/xmpp/ResumeTask.js index b1b1e4a77a..e5bc2ca10d 100644 --- a/modules/xmpp/ResumeTask.js +++ b/modules/xmpp/ResumeTask.js @@ -29,7 +29,7 @@ export default class ResumeTask { */ this._resumeRetryN = 0; - this._retryDelay = undefined; + this._resumeTimeout = undefined; } /** @@ -39,14 +39,6 @@ export default class ResumeTask { return this._resumeRetryN; } - /** - * @returns {number|undefined} - How much the app will wait before trying to resume the XMPP connection. When - * 'undefined' it means that no resume task was not scheduled. - */ - get retryDelay() { - return this._retryDelay; - } - /** * Called by {@link XmppConnection} when the connection drops and it's a signal it wants to schedule a reconnect. * @@ -88,14 +80,14 @@ export default class ResumeTask { // 1st retry: 1.5s - 3s // 2nd retry: 3s - 9s // 3rd and next retry: 4.5s - 27s - this._retryDelay = getJitterDelay( + const retryDelay = getJitterDelay( /* retry */ this._resumeRetryN, /* minDelay */ this._resumeRetryN * 1500, 3); - logger.info(`Will try to resume the XMPP connection in ${this.retryDelay}ms`); + logger.info(`Will try to resume the XMPP connection in ${retryDelay}ms`); - this._resumeTimeout = setTimeout(() => this._resumeConnection(), this.retryDelay); + this._resumeTimeout = setTimeout(() => this._resumeConnection(), retryDelay); } /** @@ -109,7 +101,6 @@ export default class ResumeTask { logger.info('Canceling connection resume task'); clearTimeout(this._resumeTimeout); this._resumeTimeout = undefined; - this._retryDelay = undefined; } } diff --git a/types/hand-crafted/modules/xmpp/ResumeTask.d.ts b/types/hand-crafted/modules/xmpp/ResumeTask.d.ts index 56f6de16bd..93eac92adc 100644 --- a/types/hand-crafted/modules/xmpp/ResumeTask.d.ts +++ b/types/hand-crafted/modules/xmpp/ResumeTask.d.ts @@ -1,6 +1,6 @@ export default class ResumeTask { constructor( stropheConnection: Strophe.Connection ); - retryDelay: () => number | undefined; + retryCount: () => number; schedule: () => void; cancel: () => void; }