MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / checkForUpdatesAndNotify

Function checkForUpdatesAndNotify

projects/electron/src/modules/autoUpdate.ts:42–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40}
41
42function checkForUpdatesAndNotify() {
43 if (!autoUpdater.isUpdaterActive()) {
44 return Promise.resolve(null)
45 }
46 return autoUpdater
47 .checkForUpdates()
48 .then((it) => {
49 lastSuccessfulCheckTime = Date.now()
50 if (!it) {
51 return
52 }
53 const downloadPromise = it.downloadPromise
54 if (downloadPromise == null) {
55 // @ts-ignore
56 const debug = autoUpdater._logger.debug
57 if (debug != null) {
58 debug("checkForUpdatesAndNotify called, downloadPromise is null")
59 }
60 return it
61 }
62 downloadPromise
63 .then(() => {
64 notifyFeOnUpdateAvailable()
65 })
66 .catch((e: unknown) => {
67 logger.warn("Auto-update download failed", e)
68 notifyFeOnUpdateError()
69 })
70 return it
71 })
72 .catch((e: unknown) => {
73 logger.warn("Auto-update check failed", e)
74 if (Date.now() - lastSuccessfulCheckTime > STALE_UPDATE_THRESHOLD_MS) {
75 notifyFeOnUpdateError()
76 }
77 return null
78 })
79}
80
81export const load = () => {
82 // Check for updates

Callers 1

loadFunction · 0.85

Calls 2

notifyFeOnUpdateErrorFunction · 0.85

Tested by

no test coverage detected