fix(ui): reentrancy guard on Health/AlarmSummary poll timers (arch-review S3)
Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
This commit is contained in:
@@ -444,6 +444,7 @@
|
||||
private IReadOnlyDictionary<string, SiteHealthState> _siteStates = new Dictionary<string, SiteHealthState>();
|
||||
private Dictionary<string, string> _siteNames = new();
|
||||
private Timer? _refreshTimer;
|
||||
private readonly ZB.MOM.WW.ScadaBridge.CentralUI.Services.PollGate _pollGate = new();
|
||||
private int _autoRefreshSeconds = 10;
|
||||
|
||||
// Notification Outbox headline KPIs, refreshed alongside the site states.
|
||||
@@ -542,10 +543,18 @@
|
||||
|
||||
_refreshTimer = new Timer(_ =>
|
||||
{
|
||||
if (!_pollGate.TryEnter()) return;
|
||||
InvokeAsync(async () =>
|
||||
{
|
||||
await RefreshNow();
|
||||
StateHasChanged();
|
||||
try
|
||||
{
|
||||
await RefreshNow();
|
||||
StateHasChanged();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_pollGate.Exit();
|
||||
}
|
||||
});
|
||||
}, null, TimeSpan.FromSeconds(_autoRefreshSeconds), TimeSpan.FromSeconds(_autoRefreshSeconds));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user