Add "clean up timer if necessary" utility

This commit is contained in:
Evan Hahn 2022-02-25 12:37:15 -06:00 committed by GitHub
parent c2a65306e2
commit 052a8e65e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 150 additions and 137 deletions

View file

@ -45,6 +45,7 @@ import { dropNull } from '../util/dropNull';
import { normalizeUuid } from '../util/normalizeUuid';
import { normalizeNumber } from '../util/normalizeNumber';
import { parseIntOrThrow } from '../util/parseIntOrThrow';
import { clearTimeoutIfNecessary } from '../util/clearTimeoutIfNecessary';
import { Zone } from '../util/Zone';
import { deriveMasterKeyFromGroupV1 } from '../Crypto';
import type { DownloadedAttachmentType } from '../types/Attachment';
@ -756,10 +757,8 @@ export default class MessageReceiver
}
private clearRetryTimeout(): void {
if (this.retryCachedTimeout) {
clearInterval(this.retryCachedTimeout);
this.retryCachedTimeout = undefined;
}
clearTimeoutIfNecessary(this.retryCachedTimeout);
this.retryCachedTimeout = undefined;
}
private maybeScheduleRetryTimeout(): void {