update locks

This commit is contained in:
Luke Pulverenti 2016-10-29 19:49:23 -04:00
parent 4807be3b09
commit fd04fddca0
4 changed files with 6 additions and 12 deletions

View File

@ -560,8 +560,6 @@ namespace MediaBrowser.Providers.Manager
new MetadataOptions();
}
private readonly ConcurrentDictionary<string, SemaphoreSlim> _fileLocks = new ConcurrentDictionary<string, SemaphoreSlim>();
/// <summary>
/// Saves the metadata.
/// </summary>
@ -585,6 +583,7 @@ namespace MediaBrowser.Providers.Manager
return SaveMetadata(item, updateType, _savers.Where(i => savers.Contains(i.Name, StringComparer.OrdinalIgnoreCase)));
}
private readonly SemaphoreSlim _saveLock = new SemaphoreSlim(1,1);
/// <summary>
/// Saves the metadata.
/// </summary>
@ -614,9 +613,7 @@ namespace MediaBrowser.Providers.Manager
continue;
}
var semaphore = _fileLocks.GetOrAdd(path, key => new SemaphoreSlim(1, 1));
await semaphore.WaitAsync().ConfigureAwait(false);
await _saveLock.WaitAsync().ConfigureAwait(false);
try
{
@ -629,8 +626,8 @@ namespace MediaBrowser.Providers.Manager
}
finally
{
_saveLock.Release();
_libraryMonitor.ReportFileSystemChangeComplete(path, false);
semaphore.Release();
}
}
else

View File

@ -657,8 +657,7 @@ namespace MediaBrowser.Providers.Movies
return _httpClient.GetResponse(new HttpRequestOptions
{
CancellationToken = cancellationToken,
Url = url,
ResourcePool = MovieDbResourcePool
Url = url
});
}
}

View File

@ -206,8 +206,7 @@ namespace MediaBrowser.Providers.Music
return _httpClient.GetResponse(new HttpRequestOptions
{
CancellationToken = cancellationToken,
Url = url,
ResourcePool = FanArtResourcePool
Url = url
});
}

View File

@ -224,8 +224,7 @@ namespace MediaBrowser.Providers.TV
return _httpClient.GetResponse(new HttpRequestOptions
{
CancellationToken = cancellationToken,
Url = url,
ResourcePool = FanartArtistProvider.Current.FanArtResourcePool
Url = url
});
}