fix: possible error "storage must be open first" at startup
Massimo Melina committed
Mar 15, 2026 at 11:10 UTC
c5e04e6452ef5b3c84949f85179064df831b21d8
2 files changed
+4
-2
src/github.ts
+2
-1
@@ -285,7 +285,8 @@ export const getProjectInfo = debounceAsync(
285
() => argv.central === false ? Promise.resolve(builtIn) : readGithubFile(`${HFS_REPO}/${branch}/${FN}`)
286
.catch(e => RUNNING_BETA ? readGithubFile(`${HFS_REPO}/main/${FN}`) : Promise.reject(e)) // for beta versions, try again with 'main'
287
.then(JSON.parse, () => null)
288
- .then(o => {
288
+ .then(async o => {
289
+ await cachedCentralInfo.ready()
290
if (o)
291
cachedCentralInfo.set(o)
292
o ||= { ...cachedCentralInfo.get() || builtIn } // fall back to built-in
src/throttler.ts
+2
-1
@@ -64,7 +64,8 @@ export const throttler: Koa.Middleware = async (ctx, next) => {
64
if (outSpeed || !closed)
65
conn[SymTimeout] = setTimeout(update, DELAY)
66
}, DELAY, { leading: true, maxWait:DELAY })
67
- ts.on('sent', (n: number) => {
67
+ ts.on('sent', async (n: number) => {
68
+ await totalSent.ready()
69
totalSent.set(x => x + n)
70
update()
71
})