refactor: dedupe process-scoped lock maps

This commit is contained in:
Peter Steinberger
2026-02-17 00:44:38 +00:00
parent c70597daeb
commit 7147cd9cc0
3 changed files with 16 additions and 23 deletions

View 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;
}