mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: Rare timing issue on first-use causing duplicate naming config (#2790)
Fixes #2773
This commit is contained in:
parent
0d5c71d205
commit
009abaf9be
@ -0,0 +1,15 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(148)]
|
||||
public class remove_extra_naming_config : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
// Remove all but 1 NamingConfig
|
||||
Execute.Sql("DELETE FROM NamingConfig WHERE ID NOT IN(SELECT ID FROM NamingConfig LIMIT 1)");
|
||||
}
|
||||
}
|
||||
}
|
@ -125,6 +125,7 @@
|
||||
<Compile Include="Authentication\UserRepository.cs" />
|
||||
<Compile Include="Authentication\UserService.cs" />
|
||||
<Compile Include="Datastore\Migration\123_create_netimport_table.cs" />
|
||||
<Compile Include="Datastore\Migration\148_remove_extra_naming_config.cs" />
|
||||
<Compile Include="Datastore\Migration\146_naming_config_colon_replacement_format.cs" />
|
||||
<Compile Include="Datastore\Migration\143_clean_core_tv.cs" />
|
||||
<Compile Include="Datastore\Migration\142_movie_extras.cs" />
|
||||
|
@ -21,8 +21,16 @@ public NamingConfig GetConfig()
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
_repository.Insert(NamingConfig.Default);
|
||||
config = _repository.Single();
|
||||
lock (_repository)
|
||||
{
|
||||
config = _repository.SingleOrDefault();
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
_repository.Insert(NamingConfig.Default);
|
||||
config = _repository.Single();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return config;
|
||||
@ -33,4 +41,4 @@ public void Save(NamingConfig namingConfig)
|
||||
_repository.Upsert(namingConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user