Spaces:
Running
Running
Commit ·
724fc63
1
Parent(s): dd679c3
fix: clear WAL locks using actual DB path from connection string
Browse files232 unmodified lines233234235236237238239240241242243244245246247232 unmodified linesdb.Database.SetCommandTimeout(120); // 2 minutesdb.Database.Migrate();// Manual lock clearingtry {string dbPath = "/app/taskflow.db";if (File.Exists(dbPath)) {foreach (var s in new[] { "-wal", "-shm", "-journal" }) {if (File.Exists(dbPath + s)) File.Delete(dbPath + s);}}} catch {}// Auto-seed achievementsvar achievementService = scope.ServiceProvider.GetRequiredService<IAchievementService>();232 unmodified lines233234235236237238239240241242243244245246247248249250251252253254232 unmodified linesdb.Database.SetCommandTimeout(120); // 2 minutesdb.Database.Migrate();// Manual lock clearing — use actual DB path from configtry {var connStrForLock = builder.Configuration.GetConnectionString("DefaultConnection") ?? "";var lockMatch = System.Text.RegularExpressions.Regex.Match(connStrForLock, @"Data Source=(.+?)(?:;|$)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);string dbPath = lockMatch.Success ? lockMatch.Groups[1].Value.Trim() : "/app/taskflow.db";if (File.Exists(dbPath)) {foreach (var s in new[] { "-wal", "-shm", "-journal" }) {if (File.Exists(dbPath + s)) {File.Delete(dbPath + s);Console.WriteLine($"[Startup] Cleared stale lock file: {dbPath + s}");}}}} catch (Exception ex) {Console.WriteLine($"[Startup] Lock clearing failed: {ex.Message}");}// Auto-seed achievementsvar achievementService = scope.ServiceProvider.GetRequiredService<IAchievementService>();
FlowAPI/Program.cs+11-4