mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 19:54:32 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -37,16 +37,24 @@ const DEFAULT_MANIFEST_CACHE_MS = 200;
|
||||
|
||||
function resolveManifestCacheMs(env: NodeJS.ProcessEnv): number {
|
||||
const raw = env.OPENCLAW_PLUGIN_MANIFEST_CACHE_MS?.trim();
|
||||
if (raw === "" || raw === "0") return 0;
|
||||
if (!raw) return DEFAULT_MANIFEST_CACHE_MS;
|
||||
if (raw === "" || raw === "0") {
|
||||
return 0;
|
||||
}
|
||||
if (!raw) {
|
||||
return DEFAULT_MANIFEST_CACHE_MS;
|
||||
}
|
||||
const parsed = Number.parseInt(raw, 10);
|
||||
if (!Number.isFinite(parsed)) return DEFAULT_MANIFEST_CACHE_MS;
|
||||
if (!Number.isFinite(parsed)) {
|
||||
return DEFAULT_MANIFEST_CACHE_MS;
|
||||
}
|
||||
return Math.max(0, parsed);
|
||||
}
|
||||
|
||||
function shouldUseManifestCache(env: NodeJS.ProcessEnv): boolean {
|
||||
const disabled = env.OPENCLAW_DISABLE_PLUGIN_MANIFEST_CACHE?.trim();
|
||||
if (disabled) return false;
|
||||
if (disabled) {
|
||||
return false;
|
||||
}
|
||||
return resolveManifestCacheMs(env) > 0;
|
||||
}
|
||||
|
||||
@@ -114,7 +122,9 @@ export function loadPluginManifestRegistry(params: {
|
||||
const cacheEnabled = params.cache !== false && shouldUseManifestCache(env);
|
||||
if (cacheEnabled) {
|
||||
const cached = registryCache.get(cacheKey);
|
||||
if (cached && cached.expiresAt > Date.now()) return cached.registry;
|
||||
if (cached && cached.expiresAt > Date.now()) {
|
||||
return cached.registry;
|
||||
}
|
||||
}
|
||||
|
||||
const discovery = params.candidates
|
||||
|
||||
Reference in New Issue
Block a user