diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-08-18 03:45:53 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-18 03:45:53 +0300 |
| commit | d497ee14dd3f2b5325a16d0de779ed6bd62178ee (patch) | |
| tree | f8f96edd0eaa0fa7641387eceb659793dc566aba /website | |
| parent | b177acf014d57e8deaf0ba5934b9ddf5f252e8d6 (diff) | |
fix: retry Windows installer activation after transient locks (#2921)
refs #2916
Diffstat (limited to 'website')
| -rw-r--r-- | website/install.ps1 | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/website/install.ps1 b/website/install.ps1 index 55b3b381..cef4af04 100644 --- a/website/install.ps1 +++ b/website/install.ps1 @@ -372,6 +372,40 @@ function Test-HerdrReleaseComplete { return $true } +function Move-DirectoryWithRetry { + param( + [string]$Source, + [string]$Destination, + [int]$TimeoutMilliseconds = 5000 + ) + + $deadline = [DateTime]::UtcNow.AddMilliseconds($TimeoutMilliseconds) + while ($true) { + try { + [System.IO.Directory]::Move($Source, $Destination) + return + } catch { + $retryable = $false + $exception = $_.Exception + while ($null -ne $exception) { + if ($exception -is [System.IO.IOException] -or + $exception -is [System.UnauthorizedAccessException]) { + $retryable = $true + break + } + $exception = $exception.InnerException + } + if (-not $retryable -or + [DateTime]::UtcNow -ge $deadline -or + -not (Test-Path -LiteralPath $Source -PathType Container) -or + (Test-Path -LiteralPath $Destination)) { + throw + } + Start-Sleep -Milliseconds 100 + } + } +} + function Invoke-WithInstallLock { param( [string]$LockPath, @@ -668,7 +702,7 @@ try { [System.IO.Directory]::Move($releaseDir, $backupDir) } try { - [System.IO.Directory]::Move($stagingDir, $releaseDir) + Move-DirectoryWithRetry -Source $stagingDir -Destination $releaseDir } catch { if ($null -ne $backupDir -and -not (Test-Path -LiteralPath $releaseDir)) { [System.IO.Directory]::Move($backupDir, $releaseDir) |
