mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
cleaner
This commit is contained in:
parent
db2e667936
commit
7841378506
@ -743,14 +743,14 @@ namespace MediaBrowser.Providers.Music
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal async Task<HttpResponseMessage> GetMusicBrainzResponse(string url, CancellationToken cancellationToken)
|
internal async Task<HttpResponseMessage> GetMusicBrainzResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
HttpResponseMessage response;
|
|
||||||
var attempts = 0u;
|
|
||||||
var requestUrl = _musicBrainzBaseUrl.TrimEnd('/') + url;
|
|
||||||
|
|
||||||
await _apiRequestLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await _apiRequestLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
HttpResponseMessage response;
|
||||||
|
var attempts = 0u;
|
||||||
|
var requestUrl = _musicBrainzBaseUrl.TrimEnd('/') + url;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
attempts++;
|
attempts++;
|
||||||
@ -767,7 +767,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
_logger.LogDebug("GetMusicBrainzResponse: Time since previous request: {0} ms", _stopWatchMusicBrainz.ElapsedMilliseconds);
|
_logger.LogDebug("GetMusicBrainzResponse: Time since previous request: {0} ms", _stopWatchMusicBrainz.ElapsedMilliseconds);
|
||||||
_stopWatchMusicBrainz.Restart();
|
_stopWatchMusicBrainz.Restart();
|
||||||
|
|
||||||
using var request = new HttpRequestMessage(HttpMethod.Get, _musicBrainzBaseUrl.TrimEnd('/') + url);
|
using var request = new HttpRequestMessage(HttpMethod.Get, requestUrl);
|
||||||
|
|
||||||
// MusicBrainz request a contact email address is supplied, as comment, in user agent field:
|
// MusicBrainz request a contact email address is supplied, as comment, in user agent field:
|
||||||
// https://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting#User-Agent
|
// https://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting#User-Agent
|
||||||
@ -788,13 +788,13 @@ namespace MediaBrowser.Providers.Music
|
|||||||
{
|
{
|
||||||
_logger.LogError("GetMusicBrainzResponse: 503 Service Unavailable (throttled) response received {0} times whilst requesting {1}", attempts, requestUrl);
|
_logger.LogError("GetMusicBrainzResponse: 503 Service Unavailable (throttled) response received {0} times whilst requesting {1}", attempts, requestUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_apiRequestLock.Release();
|
_apiRequestLock.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
Loading…
Reference in New Issue
Block a user