perf(site-runtime): per-attribute child routing in InstanceActor — attribute changes reach only interested children (P2)
This commit is contained in:
@@ -563,23 +563,21 @@ public class ScriptActor : ReceiveActor, IWithTimers
|
||||
|
||||
private static ValueChangeTriggerConfig? ParseValueChangeTrigger(string? json)
|
||||
{
|
||||
if (string.IsNullOrEmpty(json)) return null;
|
||||
try
|
||||
{
|
||||
var doc = JsonDocument.Parse(json);
|
||||
var attr = doc.RootElement.GetProperty("attributeName").GetString()!;
|
||||
return new ValueChangeTriggerConfig(attr);
|
||||
}
|
||||
catch { return null; }
|
||||
// Share the monitored-attribute parser with InstanceActor's routing map (P2) so both
|
||||
// agree on which attribute this trigger reacts to.
|
||||
return TriggerRouting.TryReadAttributeName(json, out var attr)
|
||||
? new ValueChangeTriggerConfig(attr)
|
||||
: null;
|
||||
}
|
||||
|
||||
private static ConditionalTriggerConfig? ParseConditionalTrigger(string? json)
|
||||
{
|
||||
if (string.IsNullOrEmpty(json)) return null;
|
||||
// Attribute name comes from the shared parser (P2); operator/threshold/mode stay local.
|
||||
if (!TriggerRouting.TryReadAttributeName(json, out var attr)) return null;
|
||||
try
|
||||
{
|
||||
var doc = JsonDocument.Parse(json);
|
||||
var attr = doc.RootElement.GetProperty("attributeName").GetString()!;
|
||||
var op = doc.RootElement.GetProperty("operator").GetString()!;
|
||||
var threshold = doc.RootElement.GetProperty("threshold").GetDouble();
|
||||
return new ConditionalTriggerConfig(
|
||||
|
||||
Reference in New Issue
Block a user