1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-28 10:48:46 +00:00

Rare timing issue on first-use causing duplicate naming config.

This commit is contained in:
Taloth Saldono 2017-12-13 20:25:29 +01:00
parent 4ca5e978ac
commit 0553a39a02

View file

@ -21,8 +21,16 @@ namespace NzbDrone.Core.Organizer
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 @@ namespace NzbDrone.Core.Organizer
_repository.Upsert(namingConfig);
}
}
}
}