Skip to content

Commit 26888ad

Browse files
James Blairclaude
andcommitted
fix: add PooledConnectionLifetime to static discovery HttpClient
The static HttpClient used for OIDC discovery document fetching never recycled its handler, meaning DNS changes to the IdP would not be picked up in containerized deployments. Adding PooledConnectionLifetime of 5 minutes ensures connections are recycled periodically. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent a9b9f9b commit 26888ad

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/SEBT.Portal.Api/Services/OidcExchangeService.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ public sealed class OidcExchangeService : IOidcExchangeService
103103
/// </summary>
104104
private static readonly ConcurrentDictionary<string, ConfigurationManager<OpenIdConnectConfiguration>>
105105
DiscoveryManagers = new(StringComparer.OrdinalIgnoreCase);
106-
private static readonly HttpClient DiscoveryHttpClient = new() { Timeout = TimeSpan.FromSeconds(30) };
106+
private static readonly HttpClient DiscoveryHttpClient = new(
107+
new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(5) })
108+
{
109+
Timeout = TimeSpan.FromSeconds(30)
110+
};
107111

108112
/// <inheritdoc cref="OidcExchangeService"/>
109113
public OidcExchangeService(

0 commit comments

Comments
 (0)