MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / refreshCacheInBackground

Function refreshCacheInBackground

apps/cli/src/update-checker.ts:201–211  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

199 * Runs in background so CLI startup is never blocked by network IO.
200 */
201function 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.

Callers 2

startPeriodicUpdateCheckFunction · 0.85

Calls 3

fetchLatestVersionFunction · 0.85
writeCacheFunction · 0.85
nowMethod · 0.45

Tested by

no test coverage detected