mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 01:18:28 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -23,7 +23,9 @@ function isSessionManagerCacheEnabled(): boolean {
|
||||
}
|
||||
|
||||
export function trackSessionManagerAccess(sessionFile: string): void {
|
||||
if (!isSessionManagerCacheEnabled()) return;
|
||||
if (!isSessionManagerCacheEnabled()) {
|
||||
return;
|
||||
}
|
||||
const now = Date.now();
|
||||
SESSION_MANAGER_CACHE.set(sessionFile, {
|
||||
sessionFile,
|
||||
@@ -32,17 +34,25 @@ export function trackSessionManagerAccess(sessionFile: string): void {
|
||||
}
|
||||
|
||||
function isSessionManagerCached(sessionFile: string): boolean {
|
||||
if (!isSessionManagerCacheEnabled()) return false;
|
||||
if (!isSessionManagerCacheEnabled()) {
|
||||
return false;
|
||||
}
|
||||
const entry = SESSION_MANAGER_CACHE.get(sessionFile);
|
||||
if (!entry) return false;
|
||||
if (!entry) {
|
||||
return false;
|
||||
}
|
||||
const now = Date.now();
|
||||
const ttl = getSessionManagerTtl();
|
||||
return now - entry.loadedAt <= ttl;
|
||||
}
|
||||
|
||||
export async function prewarmSessionFile(sessionFile: string): Promise<void> {
|
||||
if (!isSessionManagerCacheEnabled()) return;
|
||||
if (isSessionManagerCached(sessionFile)) return;
|
||||
if (!isSessionManagerCacheEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (isSessionManagerCached(sessionFile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Read a small chunk to encourage OS page cache warmup.
|
||||
|
||||
Reference in New Issue
Block a user