Set the CommandTimeout longer to see if EF can get a handle on the SQLite file when it's locked #2750

pull/2900/head
tidusjar 6 years ago
parent d1086e8ae0
commit c8415f8da9

@ -13,6 +13,7 @@ namespace Ombi.Store.Context
if (_created) return;
_created = true;
Database.SetCommandTimeout(60);
Database.Migrate();
}

@ -18,6 +18,7 @@ namespace Ombi.Store.Context
if (_created) return;
_created = true;
Database.SetCommandTimeout(60);
Database.Migrate();
}
@ -107,6 +108,7 @@ namespace Ombi.Store.Context
var allAgents = Enum.GetValues(typeof(NotificationAgent)).Cast<NotificationAgent>().ToList();
var allTypes = Enum.GetValues(typeof(NotificationType)).Cast<NotificationType>().ToList();
var needToSave = false;
foreach (var agent in allAgents)
{
foreach (var notificationType in allTypes)
@ -116,6 +118,8 @@ namespace Ombi.Store.Context
// We already have this
continue;
}
needToSave = true;
NotificationTemplates notificationToAdd;
switch (notificationType)
{
@ -230,7 +234,11 @@ namespace Ombi.Store.Context
NotificationTemplates.Add(notificationToAdd);
}
}
SaveChanges();
if (needToSave)
{
SaveChanges();
}
}
}
}

@ -14,6 +14,7 @@ namespace Ombi.Store.Context
if (_created) return;
_created = true;
Database.SetCommandTimeout(60);
Database.Migrate();
}
@ -63,13 +64,6 @@ namespace Ombi.Store.Context
});
SaveChanges();
}
SaveChanges();
}
~SettingsContext()
{
}
}
}

@ -91,9 +91,7 @@ namespace Ombi
dbBaseUrl.Value = baseUrl;
ctx.SaveChanges();
}
DeleteSchedulesDb();
Console.WriteLine($"We are running on {urlValue}");
CreateWebHostBuilder(args).Build().Run();
@ -226,20 +224,6 @@ namespace Ombi
}
}
private static void DeleteSchedulesDb()
{
try
{
if (File.Exists("Schedules.db"))
{
File.Delete("Schedules.db");
}
}
catch (Exception)
{
}
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()

Loading…
Cancel
Save