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