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:
tidusjar 2019-02-25 21:36:19 +00:00
commit c8415f8da9
4 changed files with 12 additions and 25 deletions

View file

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

View file

@ -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();
}
}
}
}

View file

@ -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()
{
}
}
}