fix: admin/home: update suggestion could be stale

Massimo Melina committed Apr 5, 2026 at 12:04 UTC 08306e94280852b74992c46e3752ebdc7fdd70bf
1 file changed +4 -4
src/update.ts
+4 -4
@@ -4,12 +4,12 @@ import { apiGithubPaginated, getProjectInfo, getRepoInfo } from './github'
4 import { ARGS_FILE, HFS_REPO, IS_BINARY, IS_WINDOWS, PREVIOUS_TAG, RUNNING_BETA } from './const'
5 import { dirname, join } from 'path'
6 import { spawn, spawnSync } from 'child_process'
7 -import { DAY, exists, debounceAsync, unzip, prefix, xlate, HOUR, httpWithBody, statWithTimeout } from './misc'
7 +import { DAY, exists, unzip, prefix, xlate, HOUR, httpWithBody, statWithTimeout, repeat } from './misc'
8 import { createReadStream, existsSync, renameSync, unlinkSync, writeFileSync } from 'fs'
9 import { pluginsWatcher } from './plugins'
10 import { chmod, rename, writeFile, rm } from 'fs/promises'
11 import open from 'open'
12 -import { currentVersion, defineConfig, versionToScalar } from './config'
12 +import { configReady, currentVersion, defineConfig, versionToScalar } from './config'
13 import { cmdEscape, RUNNING_AS_SERVICE } from './util-os'
14 import { onProcessExit } from './first'
15 import { storedMap } from './persistence'
@@ -29,7 +29,7 @@ autoCheckUpdateResult.ready().then(() => {
29 return v
30 })
31 })
32 -setInterval(debounceAsync(async () => {
32 +configReady.then(lastCheckUpdate.ready).then(() => repeat(HOUR, async () => {
33 if (!autoCheckUpdate.get()) return
34 if (Date.now() < lastCheckUpdate.get() + AUTO_CHECK_EVERY) return
35 console.log("checking for updates")
@@ -40,7 +40,7 @@ setInterval(debounceAsync(async () => {
40 lastCheckUpdate.set(Date.now())
41 }
42 catch {}
43 -}), HOUR)
43 +}))
44
45 export type Release = { // not using interface, as it will not work with kvstorage.Jsonable
46 prerelease: boolean,