MCPcopy
hub / github.com/rohitg00/agentmemory / withKeyedLock

Function withKeyedLock

plugin/scripts/diagnostics.mjs:40–48  ·  view source on GitHub ↗
(key, fn)

Source from the content-addressed store, hash-verified

38//#region src/state/keyed-mutex.ts
39const locks = /* @__PURE__ */ new Map();
40function withKeyedLock(key, fn) {
41 const next = (locks.get(key) ?? Promise.resolve()).then(fn, fn);
42 const cleanup = next.then(() => {}, () => {});
43 locks.set(key, cleanup);
44 cleanup.then(() => {
45 if (locks.get(key) === cleanup) locks.delete(key);
46 });
47 return next;
48}
49
50//#endregion
51//#region src/functions/diagnostics.ts

Callers 15

registerApiTriggersFunction · 0.90
registerSlotsFunctionsFunction · 0.90
lwwMergeListFunction · 0.90
lwwMergeGraphNodesFunction · 0.90
registerMeshFunctionFunction · 0.90
applySyncDataFunction · 0.90
registerDiskSizeManagerFunction · 0.90
registerObserveFunctionFunction · 0.90

Calls 3

getMethod · 0.45
setMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected