Skip to content

Commit 699fc94

Browse files
committed
fix(sqlite): vacuum instead of on quit
1 parent 211bf7f commit 699fc94

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ let appMenu = null;
4242
let minimumMenu = null;
4343
electron.app.on('window-all-closed', async ()=>{
4444
await require('./Util/GA').default.eventAppEnd('app', 'end');
45-
await require('./DB/DB').default.exec('vacuum');
4645
electron.app.quit();
4746
});
4847

@@ -277,6 +276,7 @@ electron.app.whenReady().then(function() {
277276
submenu: [
278277
{label: 'DevTools(Main)', click: ()=>{ mainWindow.webContents.openDevTools({mode: 'detach'}); }},
279278
{label: 'DevTools(BrowserView)', click: ()=>{ BrowserViewProxy.openDevTools({mode: 'detach'}); }},
279+
{label: 'SQLite Vacuum', click: vacuum},
280280
]
281281
}
282282
];
@@ -347,7 +347,6 @@ electron.app.whenReady().then(function() {
347347

348348
async function quit() {
349349
await require('./Util/GA').default.eventAppEnd('app', 'end');
350-
await require('./DB/DB').default.exec('vacuum');
351350
electron.app.exit(0);
352351
}
353352

@@ -728,6 +727,18 @@ function zoom(diffFactor, abs) {
728727
require('./Util/GA').default.eventMenu(`zoom:${currentZoom}`);
729728
}
730729

730+
async function vacuum() {
731+
const notification = new electron.Notification({title: 'SQLite Vacuum', body: 'Running...'});
732+
notification.show();
733+
734+
const Bootstrap = require('./Bootstrap.js').default;
735+
await Bootstrap.stop();
736+
await require('./DB/DB').default.exec('vacuum');
737+
await Bootstrap.restart();
738+
739+
notification.close();
740+
}
741+
731742
// target is webview|issues|streams
732743
function commandWebContents(target, command) {
733744
// hack

0 commit comments

Comments
 (0)