mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-30 02:22:25 +00:00
refactor: dedupe process-scoped lock maps
This commit is contained in:
12
src/shared/process-scoped-map.ts
Normal file
12
src/shared/process-scoped-map.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export function resolveProcessScopedMap<T>(key: symbol): Map<string, T> {
|
||||
const proc = process as NodeJS.Process & {
|
||||
[symbolKey: symbol]: Map<string, T> | undefined;
|
||||
};
|
||||
const existing = proc[key];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
const created = new Map<string, T>();
|
||||
proc[key] = created;
|
||||
return created;
|
||||
}
|
||||
Reference in New Issue
Block a user