mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Avoid concurrent config file writes
This commit is contained in:
@@ -28,6 +28,8 @@ namespace Jackett.Services
|
||||
|
||||
public class IndexerManagerService : IIndexerManagerService
|
||||
{
|
||||
private static readonly object configWriteLock = new object();
|
||||
|
||||
private IContainer container;
|
||||
private IConfigurationService configService;
|
||||
private Logger logger;
|
||||
@@ -176,6 +178,8 @@ namespace Jackett.Services
|
||||
}
|
||||
|
||||
public void SaveConfig(IIndexer indexer, JToken obj)
|
||||
{
|
||||
lock (configWriteLock)
|
||||
{
|
||||
var uID = Guid.NewGuid().ToString("N");
|
||||
var configFilePath = GetIndexerConfigFilePath(indexer);
|
||||
@@ -232,6 +236,7 @@ namespace Jackett.Services
|
||||
logger.Error(string.Format("Error while moving {0} to {1}: {2}", configFilePathTmp, configFilePath, ex.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SortIndexers()
|
||||
{
|
||||
|
Reference in New Issue
Block a user