(cache: UpdateCheckCacheFile | null, nowMs: number)
| 153 | } |
| 154 | |
| 155 | function cacheIsFresh(cache: UpdateCheckCacheFile | null, nowMs: number): boolean { |
| 156 | if (!cache) return false; |
| 157 | if (cache.lastSuccessAt !== undefined && nowMs - cache.lastSuccessAt < UPDATE_CHECK_TTL_MS) { |
| 158 | return true; |
| 159 | } |
| 160 | // No recent success: only the failure backoff holds the network call off. |
| 161 | return nowMs - cache.lastAttemptAt < UPDATE_CHECK_FAILURE_BACKOFF_MS; |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Ensure the on-disk cache is fresh (hitting the network only past the TTL / |
no outgoing calls
no test coverage detected