UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

24 lines (23 loc) • 952 B
//#region src/infra/cron-run-exec-source.ts const MAX_TRACKED_CRON_RUN_SOURCES = 512; const activeCronRunExecSources = /* @__PURE__ */ new Map(); /** Records the cron source for one active isolated run; returns its cleanup. */ function registerCronRunExecSource(e, t) { const n = e.trim(); if (!n) return () => {}; if (activeCronRunExecSources.size >= MAX_TRACKED_CRON_RUN_SOURCES && !activeCronRunExecSources.has(n)) { const e = activeCronRunExecSources.keys().next().value; if (e !== void 0) activeCronRunExecSources.delete(e); } activeCronRunExecSources.set(n, t); return () => { if (activeCronRunExecSources.get(n) === t) activeCronRunExecSources.delete(n); }; } /** Reads the recorded cron source for an active run; absence means non-cron. */ function lookupCronRunExecSource(e) { if (!e) return; return activeCronRunExecSources.get(e.trim()); } //#endregion export { registerCronRunExecSource as n, lookupCronRunExecSource as t };