@softerist/heuristic-mcp 2.1.44 → 2.1.46
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/features/index-codebase.js +10 -6
- package/index.js +26 -0
- package/package.json +1 -1
|
@@ -150,17 +150,21 @@ export class CodebaseIndexer {
|
|
|
150
150
|
}
|
|
151
151
|
} catch (err) {
|
|
152
152
|
console.error(`[Indexer] Worker initialization failed: ${err.message}, falling back to single-threaded`);
|
|
153
|
-
this.terminateWorkers();
|
|
153
|
+
await this.terminateWorkers();
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
158
|
* Terminate all worker threads
|
|
159
159
|
*/
|
|
160
|
-
terminateWorkers() {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
async terminateWorkers() {
|
|
161
|
+
const terminations = this.workers.map((worker) => {
|
|
162
|
+
try {
|
|
163
|
+
worker.postMessage({ type: "shutdown" });
|
|
164
|
+
} catch {}
|
|
165
|
+
return worker.terminate().catch(() => null);
|
|
166
|
+
});
|
|
167
|
+
await Promise.all(terminations);
|
|
164
168
|
this.workers = [];
|
|
165
169
|
this.workerReady = [];
|
|
166
170
|
}
|
|
@@ -730,7 +734,7 @@ export class CodebaseIndexer {
|
|
|
730
734
|
|
|
731
735
|
// Cleanup workers
|
|
732
736
|
if (useWorkers) {
|
|
733
|
-
this.terminateWorkers();
|
|
737
|
+
await this.terminateWorkers();
|
|
734
738
|
}
|
|
735
739
|
|
|
736
740
|
const totalTime = ((Date.now() - totalStartTime) / 1000).toFixed(1);
|
package/index.js
CHANGED
|
@@ -248,6 +248,19 @@ process.on('SIGINT', async () => {
|
|
|
248
248
|
console.error("[Server] File watcher stopped");
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
// Give workers time to finish current batch (prevents core dump)
|
|
252
|
+
if (indexer && indexer.terminateWorkers) {
|
|
253
|
+
try {
|
|
254
|
+
console.error("[Server] Waiting for workers to finish...");
|
|
255
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
256
|
+
await indexer.terminateWorkers();
|
|
257
|
+
console.error("[Server] Workers terminated");
|
|
258
|
+
} catch (err) {
|
|
259
|
+
// Suppress native module errors during shutdown
|
|
260
|
+
console.error("[Server] Workers shutdown (with warnings)");
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
251
264
|
// Save cache
|
|
252
265
|
if (cache) {
|
|
253
266
|
await cache.save();
|
|
@@ -267,6 +280,19 @@ process.on('SIGTERM', async () => {
|
|
|
267
280
|
console.error("[Server] File watcher stopped");
|
|
268
281
|
}
|
|
269
282
|
|
|
283
|
+
// Give workers time to finish current batch (prevents core dump)
|
|
284
|
+
if (indexer && indexer.terminateWorkers) {
|
|
285
|
+
try {
|
|
286
|
+
console.error("[Server] Waiting for workers to finish...");
|
|
287
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
288
|
+
await indexer.terminateWorkers();
|
|
289
|
+
console.error("[Server] Workers terminated");
|
|
290
|
+
} catch (err) {
|
|
291
|
+
// Suppress native module errors during shutdown
|
|
292
|
+
console.error("[Server] Workers shutdown (with warnings)");
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
270
296
|
// Save cache
|
|
271
297
|
if (cache) {
|
|
272
298
|
await cache.save();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softerist/heuristic-mcp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.46",
|
|
4
4
|
"description": "An enhanced MCP server providing intelligent semantic code search with find-similar-code, recency ranking, and improved chunking. Fork of smart-coding-mcp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|