openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
11 lines (10 loc) • 691 B
JavaScript
import { a as resolveGlobalSingleton } from "./global-singleton-D7yf05nR.mjs";
//#region src/shared/detached-async-context.ts
const asyncHooks = typeof process === "undefined" ? void 0 : process.getBuiltinModule?.("node:async_hooks");
const detachedAsyncContext = asyncHooks ? resolveGlobalSingleton(Symbol.for("openclaw.detachedAsyncContext"), () => new asyncHooks.AsyncResource("openclaw.detached-async-context")) : void 0;
/** Runs under the context-free async root initialized before managed work can begin. */
function runInDetachedAsyncContext(e) {
return detachedAsyncContext ? detachedAsyncContext.runInAsyncScope(e) : e();
}
//#endregion
export { runInDetachedAsyncContext as t };