Skip to content

Commit

Permalink
fix(sqlite): vacuum instead of on quit
Browse files Browse the repository at this point in the history
  • Loading branch information
h13i32maru committed Jun 27, 2020
1 parent 211bf7f commit 699fc94
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down Expand Up @@ -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},
]
}
];
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 699fc94

Please sign in to comment.