Fix accidental loop during backup import

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2025-01-29 12:20:36 -06:00 committed by GitHub
parent c1d5a835e0
commit 71041f323b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -89,6 +89,11 @@ class TapToViewMessagesDeletionService {
}
async #checkTapToViewMessages() {
if (!this.#shouldRun()) {
window.SignalContext.log.info('checkTapToViewMessages: not running');
return;
}
const receivedAtMsForOldestTapToViewMessage =
await DataReader.getNextTapToViewMessageTimestampToAgeOut();
if (!receivedAtMsForOldestTapToViewMessage) {
@ -116,12 +121,19 @@ class TapToViewMessagesDeletionService {
clearTimeoutIfNecessary(this.#timeout);
this.#timeout = setTimeout(async () => {
if (!this.#isPaused && !window.SignalContext.isTestOrMockEnvironment()) {
await eraseTapToViewMessages();
if (!this.#shouldRun()) {
window.SignalContext.log.info('checkTapToViewMessages: not running');
return;
}
await eraseTapToViewMessages();
this.update();
}, wait);
}
#shouldRun(): boolean {
return !this.#isPaused && !window.SignalContext.isTestOrMockEnvironment();
}
}
export const tapToViewMessagesDeletionService =