update locks
This commit is contained in:
parent
4807be3b09
commit
fd04fddca0
|
@ -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
|
||||
|
|
|
@ -657,8 +657,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
return _httpClient.GetResponse(new HttpRequestOptions
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = url,
|
||||
ResourcePool = MovieDbResourcePool
|
||||
Url = url
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,8 +206,7 @@ namespace MediaBrowser.Providers.Music
|
|||
return _httpClient.GetResponse(new HttpRequestOptions
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = url,
|
||||
ResourcePool = FanArtResourcePool
|
||||
Url = url
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -224,8 +224,7 @@ namespace MediaBrowser.Providers.TV
|
|||
return _httpClient.GetResponse(new HttpRequestOptions
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = url,
|
||||
ResourcePool = FanartArtistProvider.Current.FanArtResourcePool
|
||||
Url = url
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user