perf(sessions): reuse validated overview cache on startup

This commit is contained in:
digua committed 2026-08-08 21:47:47 +08:00
1 parent 3b123b15f2
commit 5e8d1caf30
9 files changed
+281 -14

No files matched your search

+7 -1
View File
@@ -18,6 +18,12 @@ function parsePositiveInteger(value, flag) {
return parsed
}
function parseNonNegativeInteger(value, flag) {
const parsed = Number.parseInt(value, 10)
if (!Number.isInteger(parsed) || parsed < 0) throw new Error(`${flag} must be a non-negative integer`)
return parsed
}
function parseArgs(argv) {
const options = {
url: DEFAULT_URL,
@@ -40,7 +46,7 @@ function parseArgs(argv) {
if (arg === '--url') options.url = next()
else if (arg === '--runs') options.runs = parsePositiveInteger(next(), arg)
else if (arg === '--warmups') options.warmups = parsePositiveInteger(next(), arg)
else if (arg === '--warmups') options.warmups = parseNonNegativeInteger(next(), arg)
else if (arg === '--timeout') options.timeoutMs = parsePositiveInteger(next(), arg)
else if (arg === '--chrome') options.chromePath = next()
else if (arg === '--json') options.json = true