Run SQL initialize in parallel with createWindow

This commit is contained in:
Fedor Indutny 2021-04-08 16:27:41 -07:00 committed by Josh Perez
parent af9e038add
commit 207d05fd05
5 changed files with 123 additions and 30 deletions

View file

@ -8,7 +8,18 @@ import sql from './Server';
const getRealPath = pify(fs.realpath);
export async function initialize(): Promise<void> {
// Called from renderer.
export async function initialize(isTesting = false): Promise<void> {
if (!isTesting) {
ipc.send('database-ready');
await new Promise<void>(resolve => {
ipc.once('database-ready', () => {
resolve();
});
});
}
const configDir = await getRealPath(ipc.sendSync('get-user-data-path'));
const key = ipc.sendSync('user-config-key');