From 21e72909731180ffc1836710852786f88529d096 Mon Sep 17 00:00:00 2001 From: insvrg3ncy Date: Wed, 13 May 2026 23:49:30 +0300 Subject: [PATCH] fix watchdog pings --- Content.Server/Corvax/Sponsors/SponsorsManager.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Content.Server/Corvax/Sponsors/SponsorsManager.cs b/Content.Server/Corvax/Sponsors/SponsorsManager.cs index 3b5f4be4154..7cb09301589 100644 --- a/Content.Server/Corvax/Sponsors/SponsorsManager.cs +++ b/Content.Server/Corvax/Sponsors/SponsorsManager.cs @@ -156,7 +156,7 @@ public void InvalidateCache(NetUserId userId) try { - var data = await FetchSponsorDataAsync(userId, CancellationToken.None); + var data = await FetchSponsorDataAsync(userId, CancellationToken.None).ConfigureAwait(false); lock (_cacheLock) _cache[userId] = new CachedSponsor(data, DateTime.UtcNow + CacheDuration); return data; @@ -177,7 +177,8 @@ public void InvalidateCache(NetUserId userId) } var url = $"{_apiUrl.TrimEnd('/')}/api/sponsors/{userId.UserId}"; - var response = await _httpClient.GetAsync(url, cancel); + // GetCachedOrFetch uses GetResult() on the main thread; ConfigureAwait(false) avoids sync-context deadlock. + var response = await _httpClient.GetAsync(url, cancel).ConfigureAwait(false); if (!response.IsSuccessStatusCode) { @@ -185,7 +186,8 @@ public void InvalidateCache(NetUserId userId) return null; } - return await response.Content.ReadFromJsonAsync(); + return await response.Content.ReadFromJsonAsync(cancellationToken: cancel) + .ConfigureAwait(false); } private sealed record CachedSponsor(SponsorApiResponse? Data, DateTime ExpiresAt);