Skip to content

Commit 7d8c67d

Browse files
committed
Clear version warning immediately after successful deploy (#519)
* Clear version warning immediately after successful deploy * Suppress version check for 45s after deploy to avoid stale warning * TEMP: bypass source build suppression for testing * Show spinner for version during post-deploy grace period * Remove temp bypass, restore source build suppression
1 parent 3d147f7 commit 7d8c67d

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

src/NetworkOptimizer.Web/Components/Pages/WanSteering.razor

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,14 @@
8484
@(_status.BinaryDeployed ? "Deployed" : "Not Deployed")
8585
</div>
8686
</div>
87-
@if (_parsedStatus != null && !string.IsNullOrEmpty(_parsedStatus.Version))
87+
@if (_deployedAt.HasValue && (DateTime.UtcNow - _deployedAt.Value).TotalSeconds < 45)
88+
{
89+
<div class="metric">
90+
<div class="metric-label">Version</div>
91+
<div class="metric-value"><span class="spinner spinner-sm"></span></div>
92+
</div>
93+
}
94+
else if (_parsedStatus != null && !string.IsNullOrEmpty(_parsedStatus.Version))
8895
{
8996
<div class="metric">
9097
<div class="metric-label">Version</div>
@@ -504,6 +511,7 @@
504511
private ParsedDaemonStatus? _parsedStatus;
505512
private bool _showVersionWarning;
506513
private string _appVersion = "";
514+
private DateTime? _deployedAt;
507515

508516
// Rule editing
509517
private int? _editingRuleId; // null = not editing, 0 = adding new, >0 = editing existing
@@ -852,7 +860,14 @@
852860
var (success, error) = await DeployService.DeployAsync(progress);
853861
_deploySuccess = success;
854862
_deployMessage = success ? "WAN Steering deployed successfully." : error;
855-
if (success) _hasUndeployedChanges = false;
863+
if (success)
864+
{
865+
_hasUndeployedChanges = false;
866+
_showVersionWarning = false;
867+
// Suppress version check until the new binary has time to start
868+
// and write its status file (startup grace period is ~30s).
869+
_deployedAt = DateTime.UtcNow;
870+
}
856871

857872
await RefreshStatusQuietAsync();
858873
}
@@ -1109,6 +1124,11 @@
11091124
_showVersionWarning = false;
11101125
if (_parsedStatus == null) return;
11111126

1127+
// After a deploy, suppress the check for 45s (30s grace + 15s buffer)
1128+
// to avoid showing a stale warning from the old status file.
1129+
if (_deployedAt.HasValue && (DateTime.UtcNow - _deployedAt.Value).TotalSeconds < 45)
1130+
return;
1131+
11121132
_appVersion = Assembly.GetExecutingAssembly()
11131133
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
11141134
?.InformationalVersion ?? "";

0 commit comments

Comments
 (0)