feat(TRUEREF-0022): complete iteration 0 — worker-thread indexing, parallel jobs, SSE progress
- Move IndexingPipeline.run() into Worker Threads via WorkerPool - Add dedicated embedding worker thread with single model instance - Add stage/stageDetail columns to indexing_jobs schema - Create ProgressBroadcaster for SSE channel management - Add SSE endpoints: GET /api/v1/jobs/:id/stream, GET /api/v1/jobs/stream - Replace UI polling with EventSource on repo detail and admin pages - Add concurrency settings UI and API endpoint - Build worker entries separately via esbuild
This commit is contained in:
@@ -47,7 +47,29 @@ try {
|
||||
embeddingService = new EmbeddingService(db, provider, activeProfile.id);
|
||||
}
|
||||
|
||||
initializePipeline(db, embeddingService);
|
||||
// Read database path from environment
|
||||
const dbPath = process.env.DATABASE_URL;
|
||||
|
||||
// Read indexing concurrency setting from database
|
||||
let concurrency = 2; // default
|
||||
if (dbPath) {
|
||||
const concurrencyRow = db
|
||||
.prepare<[], { value: string }>(
|
||||
"SELECT value FROM settings WHERE key = 'indexing.concurrency' LIMIT 1"
|
||||
)
|
||||
.get();
|
||||
if (concurrencyRow) {
|
||||
try {
|
||||
const parsed = JSON.parse(concurrencyRow.value);
|
||||
concurrency = parsed.value ?? 2;
|
||||
} catch {
|
||||
// If parsing fails, use default
|
||||
concurrency = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initializePipeline(db, embeddingService, { concurrency, dbPath });
|
||||
console.log('[hooks.server] Indexing pipeline initialised.');
|
||||
} catch (err) {
|
||||
console.error(
|
||||
|
||||
Reference in New Issue
Block a user