Ensure that delete logs timeout does not run after resolution
This commit is contained in:
parent
4e43459d34
commit
4e6c415ad8
5 changed files with 13 additions and 16 deletions
|
@ -475,7 +475,6 @@ try {
|
|||
|
||||
// Pulling these in separately since they access filesystem, electron
|
||||
window.Signal.Debug = require('./js/modules/debug');
|
||||
window.Signal.Logs = require('./js/modules/logs');
|
||||
|
||||
window.addEventListener('contextmenu', e => {
|
||||
const editable = e.target.closest(
|
||||
|
|
|
@ -102,6 +102,7 @@ import {
|
|||
loadRecentEmojis,
|
||||
getEmojiReducerState,
|
||||
} from './util/loadRecentEmojis';
|
||||
import { deleteAllLogs } from './util/deleteAllLogs';
|
||||
|
||||
const MAX_ATTACHMENT_DOWNLOAD_AGE = 3600 * 72 * 1000;
|
||||
|
||||
|
@ -749,7 +750,7 @@ export async function startApp(): Promise<void> {
|
|||
|
||||
// This one should always be last - it could restart the app
|
||||
if (window.isBeforeVersion(lastVersion, 'v1.15.0-beta.5')) {
|
||||
await window.Signal.Logs.deleteAll();
|
||||
await deleteAllLogs();
|
||||
window.restart();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as log from '../logging/log';
|
||||
import { deleteAllLogs } from '../util/deleteAllLogs';
|
||||
|
||||
export async function deleteAllData(): Promise<void> {
|
||||
try {
|
||||
await window.Signal.Logs.deleteAll();
|
||||
await deleteAllLogs();
|
||||
|
||||
log.info('deleteAllData: deleted all logs');
|
||||
|
||||
|
|
|
@ -1,27 +1,24 @@
|
|||
// Copyright 2018-2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
const { ipcRenderer } = require('electron');
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
const { beforeRestart } = require('../../ts/logging/set_up_renderer_logging');
|
||||
import { beforeRestart } from '../logging/set_up_renderer_logging';
|
||||
|
||||
/* eslint-env node */
|
||||
|
||||
module.exports = {
|
||||
deleteAll,
|
||||
};
|
||||
|
||||
function deleteAll() {
|
||||
export function deleteAllLogs(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Restart logging again when the file stream close
|
||||
beforeRestart();
|
||||
|
||||
ipcRenderer.once('delete-all-logs-complete', resolve);
|
||||
|
||||
setTimeout(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
reject(new Error('Request to delete all logs timed out'));
|
||||
}, 5000);
|
||||
|
||||
ipcRenderer.once('delete-all-logs-complete', () => {
|
||||
clearTimeout(timeout);
|
||||
resolve();
|
||||
});
|
||||
|
||||
ipcRenderer.send('delete-all-logs');
|
||||
});
|
||||
}
|
1
ts/window.d.ts
vendored
1
ts/window.d.ts
vendored
|
@ -461,7 +461,6 @@ declare global {
|
|||
search: typeof searchSelectors;
|
||||
};
|
||||
};
|
||||
Logs: WhatIsThis;
|
||||
conversationControllerStart: WhatIsThis;
|
||||
Emojis: {
|
||||
getInitialState: () => WhatIsThis;
|
||||
|
|
Loading…
Reference in a new issue