Fix accidental loop during backup import
This commit is contained in:
parent
6be51fc866
commit
5ed76b9645
1 changed files with 14 additions and 2 deletions
|
@ -89,6 +89,11 @@ class TapToViewMessagesDeletionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async #checkTapToViewMessages() {
|
async #checkTapToViewMessages() {
|
||||||
|
if (!this.#shouldRun()) {
|
||||||
|
window.SignalContext.log.info('checkTapToViewMessages: not running');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const receivedAtMsForOldestTapToViewMessage =
|
const receivedAtMsForOldestTapToViewMessage =
|
||||||
await DataReader.getNextTapToViewMessageTimestampToAgeOut();
|
await DataReader.getNextTapToViewMessageTimestampToAgeOut();
|
||||||
if (!receivedAtMsForOldestTapToViewMessage) {
|
if (!receivedAtMsForOldestTapToViewMessage) {
|
||||||
|
@ -116,12 +121,19 @@ class TapToViewMessagesDeletionService {
|
||||||
|
|
||||||
clearTimeoutIfNecessary(this.#timeout);
|
clearTimeoutIfNecessary(this.#timeout);
|
||||||
this.#timeout = setTimeout(async () => {
|
this.#timeout = setTimeout(async () => {
|
||||||
if (!this.#isPaused && !window.SignalContext.isTestOrMockEnvironment()) {
|
if (!this.#shouldRun()) {
|
||||||
await eraseTapToViewMessages();
|
window.SignalContext.log.info('checkTapToViewMessages: not running');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await eraseTapToViewMessages();
|
||||||
this.update();
|
this.update();
|
||||||
}, wait);
|
}, wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#shouldRun(): boolean {
|
||||||
|
return !this.#isPaused && !window.SignalContext.isTestOrMockEnvironment();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const tapToViewMessagesDeletionService =
|
export const tapToViewMessagesDeletionService =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue