Skip to content
Permalink
Browse files
fix(sqlite): vacuum instead of on quit
  • Loading branch information
h13i32maru committed Jun 27, 2020
1 parent 211bf7f commit 699fc94d7a3ac55510791a33ab686b66414f1fe9
Showing 1 changed file with 13 additions and 2 deletions.
@@ -42,7 +42,6 @@ let appMenu = null;
let minimumMenu = null;
electron.app.on('window-all-closed', async ()=>{
await require('./Util/GA').default.eventAppEnd('app', 'end');
await require('./DB/DB').default.exec('vacuum');
electron.app.quit();
});

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

async function quit() {
await require('./Util/GA').default.eventAppEnd('app', 'end');
await require('./DB/DB').default.exec('vacuum');
electron.app.exit(0);
}

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

async function vacuum() {
const notification = new electron.Notification({title: 'SQLite Vacuum', body: 'Running...'});
notification.show();

const Bootstrap = require('./Bootstrap.js').default;
await Bootstrap.stop();
await require('./DB/DB').default.exec('vacuum');
await Bootstrap.restart();

notification.close();
}

// target is webview|issues|streams
function commandWebContents(target, command) {
// hack

0 comments on commit 699fc94

Please sign in to comment.