diff --git a/statusline.ps1 b/statusline.ps1 index 9ded23c..44b0824 100644 --- a/statusline.ps1 +++ b/statusline.ps1 @@ -441,7 +441,14 @@ if ($versionNeedsRefresh) { -Headers @{ "Accept" = "application/vnd.github+json" } -Method Get -TimeoutSec 5 -ErrorAction Stop $versionData = $vcResponse | ConvertTo-Json -Depth 10 $versionData | Set-Content $versionCacheFile -Force - } catch {} + } catch { + # Fetch failed — if the cache has no usable content, drop the empty + # stampede lock so the next render retries instead of the fresh mtime + # suppressing update checks for the full 24h TTL. + if ((Test-Path $versionCacheFile) -and (Get-Item $versionCacheFile).Length -eq 0) { + Remove-Item $versionCacheFile -Force -ErrorAction SilentlyContinue + } + } } $updateLine = "" diff --git a/statusline.sh b/statusline.sh index 0581d67..c2cecdf 100755 --- a/statusline.sh +++ b/statusline.sh @@ -468,6 +468,11 @@ if $version_needs_refresh; then if [ -n "$vc_response" ] && echo "$vc_response" | jq -e '.tag_name' >/dev/null 2>&1; then version_data="$vc_response" echo "$vc_response" > "$version_cache_file" + elif [ ! -s "$version_cache_file" ]; then + # Fetch failed and the cache has no usable content — drop the empty + # stampede lock so the next render retries instead of the fresh mtime + # suppressing update checks for the full 24h TTL. + rm -f "$version_cache_file" 2>/dev/null fi fi