UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

76 lines 2.05 kB
/** * Database Cleanup Manager - Permanent Solution for Orphaned Database Connections * @description Handles detection and cleanup of orphaned database processes to prevent * "unable to open database file" errors in WSL2 and Linux environments. * * Key Features: * - Automatic orphaned process detection * - Safe process termination with escalation * - PID lock file management * - WSL2-specific handling * - Graceful shutdown handlers * * @author Optimizely MCP Server * @version 1.0.0 */ export interface DatabaseCleanupOptions { dbPath: string; lockFileDir?: string; timeoutMs?: number; forceCleanup?: boolean; verbose?: boolean; } export declare class DatabaseCleanupManager { private logger; private lockFilePath; private dbPath; private options; constructor(options: DatabaseCleanupOptions); /** * Main cleanup method - call before opening database */ cleanup(): Promise<boolean>; /** * Find processes holding database file handles */ private findOrphanedDatabaseProcesses; private parseUnixProcesses; private parseWindowsProcesses; /** * Safely terminate orphaned processes */ private terminateOrphanedProcesses; /** * Check if process is running */ private isProcessRunning; /** * Clean up stale WAL files that can cause "disk I/O error" */ private cleanupWALFiles; /** * Clean up stale lock files */ private cleanupStaleLockFiles; /** * Create lock file for current process */ private createLockFile; /** * Setup cleanup handlers for graceful shutdown */ private setupCleanupHandlers; /** * Force cleanup - more aggressive approach */ private forceCleanup; /** * Helper method for delays */ private sleep; /** * Static method for WSL2 detection and path optimization */ static optimizeDatabasePath(originalPath: string): string; } //# sourceMappingURL=DatabaseCleanupManager.d.ts.map