Browse Source

add more to startup logging to determine source

pull/136/head
Trent Larson 5 days ago
parent
commit
c35655d8cf
  1. 8
      src/main.electron.ts
  2. 8
      src/services/platforms/ElectronPlatformService.ts

8
src/main.electron.ts

@ -19,14 +19,14 @@ const app = initializeApp();
const sqliteReady = new Promise<void>((resolve, reject) => {
if (!window.electron?.ipcRenderer) {
logger.error("[Main Electron] IPC renderer not available");
reject(new Error("IPC renderer not available"));
reject(new Error("[Main Electron] IPC renderer not available"));
return;
}
// Set a timeout to prevent hanging
const timeout = setTimeout(() => {
reject(new Error("SQLite initialization timeout"));
}, 30000); // 30 second timeout
reject(new Error("[Main Electron] SQLite initialization timeout"));
}, 5000); // 30 second timeout
window.electron.ipcRenderer.once('sqlite-ready', () => {
clearTimeout(timeout);
@ -39,7 +39,7 @@ const sqliteReady = new Promise<void>((resolve, reject) => {
clearTimeout(timeout);
const status = args[0] as { status: string; error?: string };
if (status.status === 'error') {
reject(new Error(status.error || 'Database initialization failed'));
reject(new Error(status.error || '[Main Electron] Database initialization failed'));
}
});
});

8
src/services/platforms/ElectronPlatformService.ts

@ -56,12 +56,12 @@ export class ElectronPlatformService implements PlatformService {
this.sqliteReadyPromise = new Promise<void>((resolve, reject) => {
if (!window.electron?.ipcRenderer) {
logger.warn('[ElectronPlatformService] IPC renderer not available');
reject(new Error('IPC renderer not available'));
reject(new Error('[ElectronPlatformService] IPC renderer not available'));
return;
}
const timeout = setTimeout(() => {
reject(new Error('SQLite initialization timeout'));
}, 30000);
reject(new Error('[ElectronPlatformService] SQLite initialization timeout'));
}, 5000);
window.electron.ipcRenderer.once('sqlite-ready', () => {
clearTimeout(timeout);
logger.info('[ElectronPlatformService] Received SQLite ready signal');
@ -73,7 +73,7 @@ export class ElectronPlatformService implements PlatformService {
const status = args[0] as { status: string; error?: string };
if (status.status === 'error') {
this.dbFatalError = true;
reject(new Error(status.error || 'Database initialization failed'));
reject(new Error(status.error || '[ElectronPlatformService] Database initialization failed'));
}
});
});

Loading…
Cancel
Save