@lojban/semantic-search-mcp 1.0.9 → 1.0.10

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +4 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lojban/semantic-search-mcp",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Local-first MCP server for semantic search using transformers.js and SQLite",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -129,7 +129,8 @@ async function startIndexing(
129
129
  console.error(`Indexed ${indexedCount} lines...`);
130
130
  };
131
131
 
132
- let processingPromise: Promise<void> | null = null;
132
+ // Single task queue: only one batch is processed at a time (no pipelining).
133
+ // We do not read the next batch until the current one is fully done, to avoid memory spikes and OS freezes.
133
134
  let batchSize = getAdaptiveBatchSize();
134
135
  console.error(`Adaptive batch size: ${batchSize} (free RAM: ${Math.round(os.freemem() / 1024 / 1024)}MB, reserve: ${RESERVE_MB}MB)`);
135
136
 
@@ -138,18 +139,12 @@ async function startIndexing(
138
139
 
139
140
  currentBatch.push(line);
140
141
  if (currentBatch.length >= batchSize) {
141
- if (processingPromise) {
142
- await processingPromise;
143
- }
144
- if (signal.aborted) break;
145
-
146
142
  const batchToProcess = currentBatch;
147
143
  currentBatch = [];
148
144
  batchSize = getAdaptiveBatchSize();
149
145
 
150
- processingPromise = processBatch(batchToProcess).catch((err) => {
151
- console.error('Error in background batch processing:', err);
152
- });
146
+ await processBatch(batchToProcess);
147
+ if (signal.aborted) break;
153
148
  }
154
149
  }
155
150
 
@@ -158,9 +153,6 @@ async function startIndexing(
158
153
  return;
159
154
  }
160
155
 
161
- if (processingPromise) {
162
- await processingPromise;
163
- }
164
156
  if (currentBatch.length > 0) {
165
157
  await processBatch(currentBatch);
166
158
  }