Improve our deletion of IndexedDB post-SQLCipher migration
This commit is contained in:
parent
6300256a3e
commit
ecf3f18762
2 changed files with 23 additions and 1 deletions
|
@ -301,10 +301,18 @@
|
||||||
await mandatoryMessageUpgrade({ upgradeMessageSchema });
|
await mandatoryMessageUpgrade({ upgradeMessageSchema });
|
||||||
await migrateAllToSQLCipher({ writeNewAttachmentData, Views });
|
await migrateAllToSQLCipher({ writeNewAttachmentData, Views });
|
||||||
await removeDatabase();
|
await removeDatabase();
|
||||||
|
try {
|
||||||
await window.Signal.Data.removeIndexedDBFiles();
|
await window.Signal.Data.removeIndexedDBFiles();
|
||||||
|
} catch (error) {
|
||||||
|
window.log.error(
|
||||||
|
'Failed to remove IndexedDB files:',
|
||||||
|
error && error.stack ? error.stack : error
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
window.installStorage(window.newStorage);
|
window.installStorage(window.newStorage);
|
||||||
await window.storage.fetch();
|
await window.storage.fetch();
|
||||||
|
await storage.put('indexeddb-delete-needed', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Views.Initialization.setMessage(window.i18n('optimizingApplication'));
|
Views.Initialization.setMessage(window.i18n('optimizingApplication'));
|
||||||
|
|
14
main.js
14
main.js
|
@ -656,6 +656,20 @@ app.on('ready', async () => {
|
||||||
await sql.initialize({ configDir: userDataPath, key });
|
await sql.initialize({ configDir: userDataPath, key });
|
||||||
await sqlChannels.initialize();
|
await sqlChannels.initialize();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const IDB_KEY = 'indexeddb-delete-needed';
|
||||||
|
const item = await sql.getItemById(IDB_KEY);
|
||||||
|
if (item && item.value) {
|
||||||
|
await sql.removeIndexedDBFiles();
|
||||||
|
await sql.removeItemById(IDB_KEY);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'(ready event handler) error deleting IndexedDB:',
|
||||||
|
error && error.stack ? error.stack : error
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async function cleanupOrphanedAttachments() {
|
async function cleanupOrphanedAttachments() {
|
||||||
const allAttachments = await attachments.getAllAttachments(userDataPath);
|
const allAttachments = await attachments.getAllAttachments(userDataPath);
|
||||||
const orphanedAttachments = await sql.removeKnownAttachments(
|
const orphanedAttachments = await sql.removeKnownAttachments(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue