fix(site-runtime): publish quality changes to site stream for real-time debug view updates
HandleConnectionQualityChanged now publishes AttributeValueChanged events to the SiteStreamManager for all affected attributes. This ensures the central UI debug view updates in real-time when a data connection disconnects and attributes go bad quality. Only publishes to the stream — does NOT notify script or alarm actors, since the value hasn't changed and firing scripts/alarms on quality-only changes would cause spurious evaluations.
This commit is contained in:
@@ -301,6 +301,10 @@ public class InstanceActor : ReceiveActor
|
|||||||
if (_configuration == null) return;
|
if (_configuration == null) return;
|
||||||
|
|
||||||
// Mark all attributes bound to this connection with the new quality
|
// Mark all attributes bound to this connection with the new quality
|
||||||
|
// and publish to the site stream so the debug view updates in real-time.
|
||||||
|
// We intentionally do NOT notify script/alarm actors here — the value
|
||||||
|
// hasn't changed, only the quality, and firing scripts/alarms would
|
||||||
|
// cause spurious evaluations.
|
||||||
var qualityStr = qualityChanged.Quality.ToString();
|
var qualityStr = qualityChanged.Quality.ToString();
|
||||||
foreach (var attr in _configuration.Attributes)
|
foreach (var attr in _configuration.Attributes)
|
||||||
{
|
{
|
||||||
@@ -309,6 +313,16 @@ public class InstanceActor : ReceiveActor
|
|||||||
{
|
{
|
||||||
_attributeQualities[attr.CanonicalName] = qualityStr;
|
_attributeQualities[attr.CanonicalName] = qualityStr;
|
||||||
_attributeTimestamps[attr.CanonicalName] = qualityChanged.Timestamp;
|
_attributeTimestamps[attr.CanonicalName] = qualityChanged.Timestamp;
|
||||||
|
|
||||||
|
// Publish quality change to stream (current value, new quality)
|
||||||
|
_attributes.TryGetValue(attr.CanonicalName, out var currentValue);
|
||||||
|
_streamManager?.PublishAttributeValueChanged(new AttributeValueChanged(
|
||||||
|
_instanceUniqueName,
|
||||||
|
attr.DataSourceReference,
|
||||||
|
attr.CanonicalName,
|
||||||
|
currentValue,
|
||||||
|
qualityStr,
|
||||||
|
qualityChanged.Timestamp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user