Merge pull request #4582 from crobibero/music-client
Use proper Named HttpClient for MusicBrainz requests
This commit is contained in:
commit
32822ef9e6
|
@ -768,16 +768,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
_stopWatchMusicBrainz.Restart();
|
_stopWatchMusicBrainz.Restart();
|
||||||
|
|
||||||
using var request = new HttpRequestMessage(HttpMethod.Get, requestUrl);
|
using var request = new HttpRequestMessage(HttpMethod.Get, requestUrl);
|
||||||
|
response = await _httpClientFactory.CreateClient(NamedClient.MusicBrainz).SendAsync(request).ConfigureAwait(false);
|
||||||
// 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 .
|
|
||||||
request.Headers.UserAgent.ParseAdd(string.Format(
|
|
||||||
CultureInfo.InvariantCulture,
|
|
||||||
"{0} ( {1} )",
|
|
||||||
_appHost.ApplicationUserAgent,
|
|
||||||
_appHost.ApplicationUserAgentAddress));
|
|
||||||
|
|
||||||
response = await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(request).ConfigureAwait(false);
|
|
||||||
|
|
||||||
// We retry a finite number of times, and only whilst MB is indicating 503 (throttling).
|
// We retry a finite number of times, and only whilst MB is indicating 503 (throttling).
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user