* Fire-and-forget: fetch latest version from npm and update local cache. * Runs in background so CLI startup is never blocked by network IO.
(existingCache: UpdateCache | null)
| 199 | * Runs in background so CLI startup is never blocked by network IO. |
| 200 | */ |
| 201 | function refreshCacheInBackground(existingCache: UpdateCache | null): void { |
| 202 | fetchLatestVersion() |
| 203 | .then((latestVersion) => { |
| 204 | writeCache({ |
| 205 | lastCheckTime: Date.now(), |
| 206 | latestVersion, |
| 207 | skippedVersion: existingCache?.skippedVersion, |
| 208 | }) |
| 209 | }) |
| 210 | .catch(() => {}) |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Start a periodic background cache refresh for long-running services. |
no test coverage detected