@k-system/tickr-mcp 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +6 -7
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -96,7 +96,7 @@ export async function startServer() {
|
|
|
96
96
|
name: "tickr",
|
|
97
97
|
version: "0.1.5",
|
|
98
98
|
});
|
|
99
|
-
// Dedup cache — klíč je
|
|
99
|
+
// Dedup cache — klíč je tool name + params (zachytí duplikáty se stejnými parametry bez ohledu na requestId)
|
|
100
100
|
// Druhý duplicitní call čeká na výsledek prvního místo opakovaného API volání
|
|
101
101
|
const pendingOps = new Map();
|
|
102
102
|
// Debug logging + dedup wrapper
|
|
@@ -108,10 +108,9 @@ export async function startServer() {
|
|
|
108
108
|
const name = args[0];
|
|
109
109
|
const originalHandler = args[handlerIndex];
|
|
110
110
|
args[handlerIndex] = async (params, extra) => {
|
|
111
|
-
// Dedup klíč:
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
const cached = pendingOps.get(requestId);
|
|
111
|
+
// Dedup klíč: tool name + params hash (primární, zachytí duplikáty se stejnými params i při různém requestId)
|
|
112
|
+
const dedupKey = name + ":" + JSON.stringify(params);
|
|
113
|
+
const cached = pendingOps.get(dedupKey);
|
|
115
114
|
if (cached) {
|
|
116
115
|
if (debug) {
|
|
117
116
|
debugLog(name, (params ?? {}), "dedup-hit", 0);
|
|
@@ -134,9 +133,9 @@ export async function startServer() {
|
|
|
134
133
|
throw err;
|
|
135
134
|
}
|
|
136
135
|
})();
|
|
137
|
-
pendingOps.set(
|
|
136
|
+
pendingOps.set(dedupKey, promise);
|
|
138
137
|
promise.finally(() => {
|
|
139
|
-
setTimeout(() => pendingOps.delete(
|
|
138
|
+
setTimeout(() => pendingOps.delete(dedupKey), 10_000);
|
|
140
139
|
});
|
|
141
140
|
return promise;
|
|
142
141
|
};
|