diff --git a/ts/sql/Client.ts b/ts/sql/Client.ts index 75312b078a..191fb7470c 100644 --- a/ts/sql/Client.ts +++ b/ts/sql/Client.ts @@ -307,10 +307,13 @@ async function goBackToMainProcess(): Promise { window.log.info('data.goBackToMainProcess: switching to main process'); // Close the database in the renderer process. - await close(); + const closePromise = close(); + // It should be the last query we run in renderer process shouldUseRendererProcess = false; + await closePromise; + // Print query statistics for whole startup const entries = Array.from(startupQueries.entries()); startupQueries.clear();