perf(runtime): O(1) attribute resolution, precomputed types, coalesced static writes, shared JSON options
This commit is contained in:
@@ -27,6 +27,15 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
private readonly ILogger<ExternalSystemClient> _logger;
|
||||
private readonly ExternalSystemGatewayOptions _options;
|
||||
|
||||
/// <summary>
|
||||
/// Shared options for the per-call AuthConfiguration JSON parse in
|
||||
/// <see cref="TryParseJsonAuth"/> (perf remediation, arch-review WP1.5) — avoids
|
||||
/// allocating a new <see cref="JsonSerializerOptions"/> (and its internal cached
|
||||
/// metadata) on every outbound call. Settings preserved exactly.
|
||||
/// </summary>
|
||||
private static readonly JsonSerializerOptions AuthJsonOptions =
|
||||
new() { PropertyNameCaseInsensitive = true };
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ExternalSystemClient.
|
||||
/// </summary>
|
||||
@@ -755,7 +764,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
{
|
||||
fields = JsonSerializer.Deserialize<Dictionary<string, string?>>(
|
||||
config,
|
||||
new JsonSerializerOptions { PropertyNameCaseInsensitive = true })
|
||||
AuthJsonOptions)
|
||||
?? new Dictionary<string, string?>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
// Normalize to case-insensitive so "Header"/"header" both resolve.
|
||||
|
||||
Reference in New Issue
Block a user