MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / checkForAppUpdates

Function checkForAppUpdates

apps/desktop/src/main/updater.ts:249–285  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

247}
248
249export async function checkForAppUpdates(): Promise<AppUpdateState> {
250 initAppUpdater()
251 if (!updater) return getAppUpdateState()
252 if (updateState.phase === 'checking') return getAppUpdateState()
253
254 setUpdateState(
255 nextStateFromInfo('checking', lastInfo, 'Checking GitHub releases for updates…')
256 )
257
258 for (let attempt = 1; attempt <= UPDATE_CHECK_MAX_ATTEMPTS; attempt += 1) {
259 try {
260 await updater.checkForUpdates()
261 return getAppUpdateState()
262 } catch (error) {
263 const retryable = isRetryableUpdateError(error)
264 const hasAttemptsLeft = attempt < UPDATE_CHECK_MAX_ATTEMPTS
265 if (retryable && hasAttemptsLeft) {
266 setUpdateState(
267 nextStateFromInfo(
268 'checking',
269 lastInfo,
270 `GitHub update check hit a temporary server error. Retrying (${attempt + 1}/${UPDATE_CHECK_MAX_ATTEMPTS})…`
271 )
272 )
273 await sleep(UPDATE_CHECK_RETRY_DELAY_MS)
274 continue
275 }
276
277 setUpdateState(
278 nextStateFromInfo('error', lastInfo, humanizeUpdateError(error))
279 )
280 break
281 }
282 }
283
284 return getAppUpdateState()
285}
286
287export function scheduleBackgroundAppUpdateCheck(
288 delayMs: number = BACKGROUND_UPDATE_CHECK_DELAY_MS

Callers 3

registerIpcFunction · 0.90
runMenuUpdateCheckFunction · 0.90

Calls 7

initAppUpdaterFunction · 0.85
setUpdateStateFunction · 0.85
nextStateFromInfoFunction · 0.85
isRetryableUpdateErrorFunction · 0.85
humanizeUpdateErrorFunction · 0.85
getAppUpdateStateFunction · 0.70
sleepFunction · 0.70

Tested by

no test coverage detected