mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-01 21:02:12 +03:00
- Add fixWreqJsBinary() to postinstall.mjs with 3-strategy repair: 1. Copy platform binary from root node_modules 2. Copy entire rust/ directory (all platform binaries) 3. npm rebuild wreq-js fallback - Fixes macOS arm64 global pnpm installs shipping only Linux binaries - Adds reasoning replay cache feature for DeepSeek V4 (#1628) - Updates CHANGELOG.md with both fixes
41 lines
995 B
TypeScript
41 lines
995 B
TypeScript
import { cleanupReasoningCache } from "../../../open-sse/services/reasoningCache.ts";
|
|
|
|
const DEFAULT_INTERVAL_MS = 30 * 60 * 1000;
|
|
|
|
let timer: NodeJS.Timeout | null = null;
|
|
|
|
function getIntervalMs() {
|
|
const raw = process.env.OMNIROUTE_REASONING_CACHE_CLEANUP_INTERVAL_MS;
|
|
const parsed = raw ? Number(raw) : Number.NaN;
|
|
return Number.isFinite(parsed) && parsed >= 60_000 ? parsed : DEFAULT_INTERVAL_MS;
|
|
}
|
|
|
|
export function startReasoningCacheCleanupJob() {
|
|
if (timer) {
|
|
return timer;
|
|
}
|
|
|
|
const run = () => {
|
|
try {
|
|
const deleted = cleanupReasoningCache();
|
|
if (deleted > 0) {
|
|
console.log(`[ReasoningCache] expired entries removed=${deleted}`);
|
|
}
|
|
} catch (error) {
|
|
console.error("[ReasoningCache] Cleanup job failed:", error);
|
|
}
|
|
};
|
|
|
|
run();
|
|
timer = setInterval(run, getIntervalMs());
|
|
timer.unref?.();
|
|
return timer;
|
|
}
|
|
|
|
export function stopReasoningCacheCleanupJob() {
|
|
if (timer) {
|
|
clearInterval(timer);
|
|
timer = null;
|
|
}
|
|
}
|