perf(runtime): O(1) attribute resolution, precomputed types, coalesced static writes, shared JSON options
This commit is contained in:
@@ -17,6 +17,15 @@ public static class ManagementEndpoints
|
||||
{
|
||||
private static readonly TimeSpan DefaultAskTimeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
/// <summary>
|
||||
/// Shared options for the per-request command payload JSON parse in
|
||||
/// <see cref="ParseCommand"/> (perf remediation, arch-review WP1.5) — avoids
|
||||
/// allocating a new <see cref="JsonSerializerOptions"/> per inbound management
|
||||
/// request. Settings preserved exactly.
|
||||
/// </summary>
|
||||
private static readonly JsonSerializerOptions CommandPayloadJsonOptions =
|
||||
new() { PropertyNameCaseInsensitive = true };
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the ManagementActor Ask timeout from configuration.
|
||||
/// Falls back to <see cref="DefaultAskTimeout"/>
|
||||
@@ -197,7 +206,7 @@ public static class ManagementEndpoints
|
||||
? p.GetRawText()
|
||||
: "{}";
|
||||
var command = JsonSerializer.Deserialize(payloadJson, commandType,
|
||||
new JsonSerializerOptions { PropertyNameCaseInsensitive = true })!;
|
||||
CommandPayloadJsonOptions)!;
|
||||
return CommandParseResult.Ok(command);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user