fix(centralui): pending-updates rail refreshes as soon as a deployment finishes — cache drops its snapshot on Success/Failed and signals the indicator, instead of serving the pre-deploy count for up to TTL + one poll
This commit is contained in:
+32
-3
@@ -140,6 +140,23 @@
|
||||
// the same circuit) must move this block, not leave it showing what the
|
||||
// previous principal was allowed to see.
|
||||
AuthStateProvider.AuthenticationStateChanged += OnAuthenticationStateChanged;
|
||||
PendingUpdates.Invalidated += OnPendingUpdatesInvalidated;
|
||||
}
|
||||
|
||||
// Set when the cache reports a finished deployment. A reload that arrives while a poll is
|
||||
// already running is dropped by the PollGate, so the running poll re-checks this flag and
|
||||
// goes round once more — otherwise the post-deploy count could wait out a full interval.
|
||||
private int _reloadRequested;
|
||||
|
||||
private void OnPendingUpdatesInvalidated()
|
||||
{
|
||||
if (_disposed || !_visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Interlocked.Exchange(ref _reloadRequested, 1);
|
||||
_ = RunLoadAsync();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
@@ -267,9 +284,20 @@
|
||||
/// </summary>
|
||||
internal Task PollOnceAsync() => RunLoadAsync();
|
||||
|
||||
private Task RunLoadAsync() => _pollGate.RunAsync(
|
||||
LoadAsync,
|
||||
error => Logger.LogDebug(error, "Pending-updates indicator poll tick failed."));
|
||||
private async Task RunLoadAsync()
|
||||
{
|
||||
await _pollGate.RunAsync(
|
||||
LoadAsync,
|
||||
error => Logger.LogDebug(error, "Pending-updates indicator poll tick failed."));
|
||||
|
||||
// A reload requested while that poll was running was dropped by the gate: run once more.
|
||||
if (!_disposed && Interlocked.Exchange(ref _reloadRequested, 0) == 1)
|
||||
{
|
||||
await _pollGate.RunAsync(
|
||||
LoadAsync,
|
||||
error => Logger.LogDebug(error, "Pending-updates indicator reload failed."));
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadAsync()
|
||||
{
|
||||
@@ -342,6 +370,7 @@
|
||||
{
|
||||
_disposed = true;
|
||||
AuthStateProvider.AuthenticationStateChanged -= OnAuthenticationStateChanged;
|
||||
PendingUpdates.Invalidated -= OnPendingUpdatesInvalidated;
|
||||
|
||||
lock (_timerLock)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user