grepmax 0.14.0 → 0.14.1
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.
|
@@ -53,6 +53,7 @@ const pool_1 = require("../workers/pool");
|
|
|
53
53
|
const watcher_batch_1 = require("./watcher-batch");
|
|
54
54
|
const DEBOUNCE_MS = 2000;
|
|
55
55
|
const MAX_RETRIES = 5;
|
|
56
|
+
const MAX_BATCH_SIZE = 50;
|
|
56
57
|
class ProjectBatchProcessor {
|
|
57
58
|
constructor(opts) {
|
|
58
59
|
this.pending = new Map();
|
|
@@ -112,12 +113,22 @@ class ProjectBatchProcessor {
|
|
|
112
113
|
(0, logger_1.log)(this.wtag, `Batch timed out after ${this.batchTimeoutMs}ms, aborting`);
|
|
113
114
|
batchAc.abort();
|
|
114
115
|
}, this.batchTimeoutMs);
|
|
115
|
-
const batch = new Map(
|
|
116
|
-
|
|
116
|
+
const batch = new Map();
|
|
117
|
+
let taken = 0;
|
|
118
|
+
for (const [absPath, event] of this.pending) {
|
|
119
|
+
batch.set(absPath, event);
|
|
120
|
+
taken++;
|
|
121
|
+
if (taken >= MAX_BATCH_SIZE)
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
for (const key of batch.keys()) {
|
|
125
|
+
this.pending.delete(key);
|
|
126
|
+
}
|
|
117
127
|
const filenames = [...batch.keys()].map((p) => path.basename(p));
|
|
118
128
|
(0, logger_1.log)(this.wtag, `Processing ${batch.size} changed files: ${filenames.join(", ")}`);
|
|
119
129
|
const start = Date.now();
|
|
120
130
|
let reindexed = 0;
|
|
131
|
+
let processed = 0;
|
|
121
132
|
try {
|
|
122
133
|
// No lock needed — daemon is the single writer to LanceDB/MetaCache
|
|
123
134
|
const pool = (0, pool_1.getWorkerPool)();
|
|
@@ -130,6 +141,10 @@ class ProjectBatchProcessor {
|
|
|
130
141
|
if (batchAc.signal.aborted)
|
|
131
142
|
break;
|
|
132
143
|
attempted.add(absPath);
|
|
144
|
+
processed++;
|
|
145
|
+
if (batch.size > 10 && (processed % 10 === 0 || processed === batch.size)) {
|
|
146
|
+
(0, logger_1.log)(this.wtag, `Progress: ${processed}/${batch.size} (${reindexed} reindexed)`);
|
|
147
|
+
}
|
|
133
148
|
if (event === "unlink") {
|
|
134
149
|
deletes.push(absPath);
|
|
135
150
|
metaDeletes.push(absPath);
|
|
@@ -219,7 +234,8 @@ class ProjectBatchProcessor {
|
|
|
219
234
|
if (reindexed > 0) {
|
|
220
235
|
(_a = this.onReindex) === null || _a === void 0 ? void 0 : _a.call(this, reindexed, duration);
|
|
221
236
|
}
|
|
222
|
-
|
|
237
|
+
const remaining = this.pending.size;
|
|
238
|
+
(0, logger_1.log)(this.wtag, `Batch complete: ${batch.size} files, ${reindexed} reindexed (${(duration / 1000).toFixed(1)}s)${remaining > 0 ? ` — ${remaining} remaining` : ""}`);
|
|
223
239
|
for (const absPath of batch.keys()) {
|
|
224
240
|
this.retryCount.delete(absPath);
|
|
225
241
|
}
|
package/package.json
CHANGED