fix(http): close socket leaks in EmoteCache and FontManager

- EmoteCache.cs replaces the per-call "new HttpClient()" with the
  existing static Client field. The static instance already exists
  for two other endpoints in the same file and reuses connection
  pooling; the third call site was a stray that leaked a socket
  on every emote download
- FontManager.cs wraps both the HttpClient and the HttpResponseMessage
  in using-blocks, replaces the .Result/AggregateException sandwich
  with GetAwaiter().GetResult() for clean exception propagation, and
  adds EnsureSuccessStatusCode so failed downloads don't silently
  produce a zero-byte font file. Full async refactor of the FontManager
  constructor is tracked separately
This commit is contained in:
2026-05-03 22:08:48 +02:00
parent e3ce41306e
commit 8ee54bb8df
2 changed files with 13 additions and 6 deletions
+1 -1
View File
@@ -192,7 +192,7 @@ public static class EmoteCache
}
else
{
var content = await new HttpClient().GetAsync(EmotePath.Format(emote.Id));
var content = await Client.GetAsync(EmotePath.Format(emote.Id));
RawData = await content.Content.ReadAsByteArrayAsync();
await using var stream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read);