mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 05:13:18 -07:00
Set the CommandTimeout longer to see if EF can get a handle on the SQLite file when it's locked #2750
This commit is contained in:
parent
d1086e8ae0
commit
c8415f8da9
4 changed files with 12 additions and 25 deletions
|
@ -13,6 +13,7 @@ namespace Ombi.Store.Context
|
||||||
if (_created) return;
|
if (_created) return;
|
||||||
|
|
||||||
_created = true;
|
_created = true;
|
||||||
|
Database.SetCommandTimeout(60);
|
||||||
Database.Migrate();
|
Database.Migrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace Ombi.Store.Context
|
||||||
if (_created) return;
|
if (_created) return;
|
||||||
|
|
||||||
_created = true;
|
_created = true;
|
||||||
|
Database.SetCommandTimeout(60);
|
||||||
Database.Migrate();
|
Database.Migrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +108,7 @@ namespace Ombi.Store.Context
|
||||||
var allAgents = Enum.GetValues(typeof(NotificationAgent)).Cast<NotificationAgent>().ToList();
|
var allAgents = Enum.GetValues(typeof(NotificationAgent)).Cast<NotificationAgent>().ToList();
|
||||||
var allTypes = Enum.GetValues(typeof(NotificationType)).Cast<NotificationType>().ToList();
|
var allTypes = Enum.GetValues(typeof(NotificationType)).Cast<NotificationType>().ToList();
|
||||||
|
|
||||||
|
var needToSave = false;
|
||||||
foreach (var agent in allAgents)
|
foreach (var agent in allAgents)
|
||||||
{
|
{
|
||||||
foreach (var notificationType in allTypes)
|
foreach (var notificationType in allTypes)
|
||||||
|
@ -116,6 +118,8 @@ namespace Ombi.Store.Context
|
||||||
// We already have this
|
// We already have this
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
needToSave = true;
|
||||||
NotificationTemplates notificationToAdd;
|
NotificationTemplates notificationToAdd;
|
||||||
switch (notificationType)
|
switch (notificationType)
|
||||||
{
|
{
|
||||||
|
@ -230,7 +234,11 @@ namespace Ombi.Store.Context
|
||||||
NotificationTemplates.Add(notificationToAdd);
|
NotificationTemplates.Add(notificationToAdd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SaveChanges();
|
|
||||||
|
if (needToSave)
|
||||||
|
{
|
||||||
|
SaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,6 +14,7 @@ namespace Ombi.Store.Context
|
||||||
if (_created) return;
|
if (_created) return;
|
||||||
|
|
||||||
_created = true;
|
_created = true;
|
||||||
|
Database.SetCommandTimeout(60);
|
||||||
Database.Migrate();
|
Database.Migrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,13 +64,6 @@ namespace Ombi.Store.Context
|
||||||
});
|
});
|
||||||
SaveChanges();
|
SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
~SettingsContext()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -91,9 +91,7 @@ namespace Ombi
|
||||||
dbBaseUrl.Value = baseUrl;
|
dbBaseUrl.Value = baseUrl;
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteSchedulesDb();
|
|
||||||
|
|
||||||
Console.WriteLine($"We are running on {urlValue}");
|
Console.WriteLine($"We are running on {urlValue}");
|
||||||
|
|
||||||
CreateWebHostBuilder(args).Build().Run();
|
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) =>
|
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
||||||
WebHost.CreateDefaultBuilder(args)
|
WebHost.CreateDefaultBuilder(args)
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue