mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
Fixed the exception that sometimes makes ombi fallover.
This commit is contained in:
parent
619ea4dbc4
commit
a6b733e954
2 changed files with 133 additions and 146 deletions
|
@ -47,8 +47,7 @@ namespace Ombi
|
|||
instance.StoragePath = storagePath ?? string.Empty;
|
||||
// Check if we need to migrate the settings
|
||||
CheckAndMigrate();
|
||||
using (var ctx = new SettingsContext())
|
||||
{
|
||||
var ctx = new SettingsContext();
|
||||
var config = ctx.ApplicationConfigurations.ToList();
|
||||
var url = config.FirstOrDefault(x => x.Type == ConfigurationTypes.Url);
|
||||
var dbBaseUrl = config.FirstOrDefault(x => x.Type == ConfigurationTypes.BaseUrl);
|
||||
|
@ -89,7 +88,6 @@ namespace Ombi
|
|||
dbBaseUrl.Value = baseUrl;
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
DeleteSchedulesDb();
|
||||
|
||||
|
@ -111,9 +109,9 @@ namespace Ombi
|
|||
{
|
||||
var doneGlobal = false;
|
||||
var doneConfig = false;
|
||||
using (var ombi = new OmbiContext())
|
||||
using (var settings = new SettingsContext())
|
||||
{
|
||||
var ombi = new OmbiContext();
|
||||
var settings = new SettingsContext();
|
||||
|
||||
try
|
||||
{
|
||||
if (ombi.Settings.Any())
|
||||
|
@ -148,15 +146,11 @@ namespace Ombi
|
|||
if (doneConfig)
|
||||
ombi.Database.ExecuteSqlCommand("DELETE FROM ApplicationConfiguration");
|
||||
|
||||
}
|
||||
|
||||
// Now migrate all the external stuff
|
||||
using (var ombi = new OmbiContext())
|
||||
using (var external = new ExternalContext())
|
||||
{
|
||||
var external = new ExternalContext();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (ombi.PlexEpisode.Any())
|
||||
{
|
||||
external.PlexEpisode.AddRange(ombi.PlexEpisode.ToList());
|
||||
|
@ -229,8 +223,6 @@ namespace Ombi
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void DeleteSchedulesDb()
|
||||
{
|
||||
try
|
||||
|
|
|
@ -237,15 +237,12 @@ namespace Ombi
|
|||
app.UseMiddleware<ApiKeyMiddlewear>();
|
||||
|
||||
app.UseCors("MyPolicy");
|
||||
//app.ApiKeyMiddlewear(app.ApplicationServices);
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
||||
});
|
||||
|
||||
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
|
@ -256,8 +253,6 @@ namespace Ombi
|
|||
name: "spa-fallback",
|
||||
defaults: new { controller = "Home", action = "Index" });
|
||||
});
|
||||
|
||||
ombiService.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue