perf(site-runtime): deserialize a deploy's flattened config once and hand the parsed object down (review 2026-10-21 01/SR-P5)
The deploy compile warm parses once off-thread; the parsed FlattenedConfiguration rides DeployCompileWarmed to the gate (new Validate(FlattenedConfiguration) overload), the redeploy buffer, CreateInstanceActor's DCL ensure and a new InstanceActor constructor overload. Stored-row paths parse once inside CreateInstanceActor; an unparseable stored row still fails init via S6.
This commit is contained in:
@@ -262,6 +262,50 @@ public class InstanceActor : ReceiveActor
|
||||
IServiceProvider? serviceProvider = null,
|
||||
TimeSpan? staticOverrideFlushInterval = null,
|
||||
Task? staticStateResetGate = null)
|
||||
: this(
|
||||
instanceUniqueName,
|
||||
JsonSerializer.Deserialize<FlattenedConfiguration>(configJson),
|
||||
storage, compilationService, sharedScriptLibrary, streamManager, options, logger,
|
||||
dclManager, healthCollector, serviceProvider, staticOverrideFlushInterval,
|
||||
staticStateResetGate)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the instance actor from an ALREADY-PARSED flattened configuration (review
|
||||
/// 2026-10-21 01/SR-P5). The Deployment Manager parses each config once — the deploy compile
|
||||
/// warm, the gate, the DCL-connection ensure and this actor all used to deserialize the same
|
||||
/// JSON separately — and hands the object over. The configuration is read-only here, so
|
||||
/// sharing the instance the Deployment Manager parsed is safe. Parameters are as for the
|
||||
/// JSON overload.
|
||||
/// </summary>
|
||||
/// <param name="instanceUniqueName">System-wide unique name identifying this instance.</param>
|
||||
/// <param name="configuration">The parsed flattened configuration (null = empty instance).</param>
|
||||
/// <param name="storage">Site storage service for loading and persisting static overrides.</param>
|
||||
/// <param name="compilationService">Service used to compile instance scripts.</param>
|
||||
/// <param name="sharedScriptLibrary">Library of shared scripts available to instance scripts.</param>
|
||||
/// <param name="streamManager">Optional site stream manager for publishing attribute/alarm changes.</param>
|
||||
/// <param name="options">Site runtime configuration options.</param>
|
||||
/// <param name="logger">Logger for this actor.</param>
|
||||
/// <param name="dclManager">Optional Data Connection Layer manager actor reference.</param>
|
||||
/// <param name="healthCollector">Optional health collector for reporting metrics.</param>
|
||||
/// <param name="serviceProvider">Optional DI service provider for script execution services.</param>
|
||||
/// <param name="staticOverrideFlushInterval">Coalescing window for buffered static-override writes.</param>
|
||||
/// <param name="staticStateResetGate">See the JSON overload.</param>
|
||||
public InstanceActor(
|
||||
string instanceUniqueName,
|
||||
FlattenedConfiguration? configuration,
|
||||
SiteStorageService storage,
|
||||
ScriptCompilationService compilationService,
|
||||
SharedScriptLibrary sharedScriptLibrary,
|
||||
SiteStreamManager? streamManager,
|
||||
SiteRuntimeOptions options,
|
||||
ILogger logger,
|
||||
IActorRef? dclManager = null,
|
||||
ISiteHealthCollector? healthCollector = null,
|
||||
IServiceProvider? serviceProvider = null,
|
||||
TimeSpan? staticOverrideFlushInterval = null,
|
||||
Task? staticStateResetGate = null)
|
||||
{
|
||||
_instanceUniqueName = instanceUniqueName;
|
||||
_storage = storage;
|
||||
@@ -277,8 +321,7 @@ public class InstanceActor : ReceiveActor
|
||||
_staticOverrideFlushInterval = staticOverrideFlushInterval ?? TimeSpan.FromMilliseconds(100);
|
||||
_staticStateResetGate = staticStateResetGate;
|
||||
|
||||
// Deserialize the flattened configuration
|
||||
_configuration = JsonSerializer.Deserialize<FlattenedConfiguration>(configJson);
|
||||
_configuration = configuration;
|
||||
|
||||
// Load default attribute values from the flattened configuration
|
||||
// Data-sourced attributes start with Uncertain quality until the first DCL value arrives.
|
||||
|
||||
Reference in New Issue
Block a user