refactor(backend): use single shared HTTP client with backoff

This commit is contained in:
sam 2025-03-11 16:10:55 +01:00
parent bba322bd22
commit 5d452824cd
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
9 changed files with 232 additions and 75 deletions

View file

@ -27,7 +27,7 @@ public partial class RemoteAuthService
)
{
var redirectUri = $"{config.BaseUrl}/auth/callback/discord";
HttpResponseMessage resp = await _httpClient.PostAsync(
HttpResponseMessage resp = await client.PostAsync(
_discordTokenUri,
new FormUrlEncodedContent(
new Dictionary<string, string>
@ -59,7 +59,7 @@ public partial class RemoteAuthService
var req = new HttpRequestMessage(HttpMethod.Get, _discordUserUri);
req.Headers.Add("Authorization", $"{token.TokenType} {token.AccessToken}");
HttpResponseMessage resp2 = await _httpClient.SendAsync(req, ct);
HttpResponseMessage resp2 = await client.SendAsync(req, ct);
resp2.EnsureSuccessStatusCode();
DiscordUserResponse? user = await resp2.Content.ReadFromJsonAsync<DiscordUserResponse>(ct);
if (user == null)