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:
Joseph Doherty
2026-07-10 05:01:27 -04:00
parent bd6c310825
commit adc488a9f9
4 changed files with 50 additions and 4 deletions
@@ -206,6 +206,7 @@
private bool _loading;
private Timer? _refreshTimer;
private readonly ZB.MOM.WW.ScadaBridge.CentralUI.Services.PollGate _pollGate = new();
private const int _autoRefreshSeconds = 15;
// ── Client-side filters ──
@@ -282,10 +283,18 @@
StopTimer();
_refreshTimer = new Timer(_ =>
{
if (!_pollGate.TryEnter()) return;
InvokeAsync(async () =>
{
await RefreshAsync();
StateHasChanged();
try
{
await RefreshAsync();
StateHasChanged();
}
finally
{
_pollGate.Exit();
}
});
}, null, TimeSpan.FromSeconds(_autoRefreshSeconds), TimeSpan.FromSeconds(_autoRefreshSeconds));
}