perf(adminui): drift chip recomposes only when the config-edit watermark moves
This commit is contained in:
@@ -6,13 +6,13 @@
|
||||
@using ZB.MOM.WW.OtOpcUa.Configuration
|
||||
@using ZB.MOM.WW.OtOpcUa.Configuration.Entities
|
||||
@using ZB.MOM.WW.OtOpcUa.Configuration.Enums
|
||||
@using ZB.MOM.WW.OtOpcUa.ControlPlane.AdminOperations
|
||||
|
||||
@attribute [Authorize(Policy = AdminUiPolicies.ConfigEditor)]
|
||||
|
||||
@inject IDbContextFactory<OtOpcUaConfigDbContext> DbFactory
|
||||
@inject IAdminOperationsClient AdminOps
|
||||
@inject AuthenticationStateProvider AuthState
|
||||
@inject ZB.MOM.WW.OtOpcUa.AdminUI.Deployments.DeploymentDriftProbe DriftProbe
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Deployments</PageTitle>
|
||||
@@ -104,16 +104,13 @@
|
||||
.Take(50)
|
||||
.ToListAsync();
|
||||
|
||||
// Drift: if no sealed deployment yet, no drift to report. Otherwise compare the latest
|
||||
// sealed revision hash to a fresh snapshot of the live-edit state.
|
||||
// Drift: if no sealed deployment yet, no drift to report. Otherwise the probe compares the
|
||||
// latest sealed revision hash to the live-edit state — recomposing only when the ConfigEdit
|
||||
// audit watermark has moved, so a re-render of this page is not a full fleet snapshot.
|
||||
var latestSealed = _deployments.FirstOrDefault(d => d.Status == DeploymentStatus.Sealed);
|
||||
if (latestSealed is null)
|
||||
{
|
||||
_drift = null;
|
||||
return;
|
||||
}
|
||||
var current = await ConfigComposer.SnapshotAndFlattenAsync(db);
|
||||
_drift = !string.Equals(current.RevisionHash, latestSealed.RevisionHash, StringComparison.Ordinal);
|
||||
_drift = latestSealed is null
|
||||
? null
|
||||
: await DriftProbe.GetDriftAsync(latestSealed.RevisionHash, CancellationToken.None);
|
||||
}
|
||||
|
||||
private async Task StartDeploymentAsync()
|
||||
|
||||
Reference in New Issue
Block a user