improved indexing error handling
This commit is contained in:
parent
a841e55b44
commit
77b4b67282
4 changed files with 47 additions and 25 deletions
|
|
@ -240,7 +240,19 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
|
|||
execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`);
|
||||
|
||||
// Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
|
||||
fs.writeFileSync(`${targetDir}/package.json`, "");
|
||||
fs.writeFileSync(
|
||||
`${targetDir}/package.json`,
|
||||
JSON.stringify(
|
||||
{
|
||||
name: "binary",
|
||||
version: "1.0.0",
|
||||
author: "Continue Dev, Inc",
|
||||
license: "Apache-2.0",
|
||||
},
|
||||
undefined,
|
||||
2,
|
||||
),
|
||||
);
|
||||
|
||||
// Copy to build directory for testing
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex.js";
|
|||
import {
|
||||
IndexResultType,
|
||||
MarkCompleteCallback,
|
||||
PathAndCacheKey,
|
||||
RefreshIndexResults,
|
||||
type CodebaseIndex,
|
||||
} from "./types.js";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import * as fs from "fs/promises";
|
||||
import { ConfigHandler } from "../config/ConfigHandler.js";
|
||||
import { IContinueServerClient } from "../continueServer/interface.js";
|
||||
import { IDE, IndexTag, IndexingProgressUpdate } from "../index.js";
|
||||
import { IDE, IndexingProgressUpdate, IndexTag } from "../index.js";
|
||||
import { extractMinimalStackTraceInfo } from "../util/extractMinimalStackTraceInfo.js";
|
||||
import { getIndexSqlitePath, getLanceDbPath } from "../util/paths.js";
|
||||
import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex.js";
|
||||
|
|
@ -126,6 +126,12 @@ export class CodebaseIndexer {
|
|||
results.removeTag = [];
|
||||
results.addTag = [];
|
||||
results.del = [];
|
||||
|
||||
// Don't update if nothing to update. Some of the indices might do unnecessary setup work
|
||||
if (results.compute.length === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for await (const _ of index.update(
|
||||
tag,
|
||||
results,
|
||||
|
|
@ -371,28 +377,33 @@ export class CodebaseIndexer {
|
|||
results.addTag.length +
|
||||
results.removeTag.length;
|
||||
let completedOps = 0;
|
||||
for (const subResult of this.batchRefreshIndexResults(results)) {
|
||||
for await (const { desc } of codebaseIndex.update(
|
||||
tag,
|
||||
subResult,
|
||||
markComplete,
|
||||
repoName,
|
||||
)) {
|
||||
yield {
|
||||
progress: progress,
|
||||
desc,
|
||||
status: "indexing",
|
||||
};
|
||||
|
||||
// Don't update if nothing to update. Some of the indices might do unnecessary setup work
|
||||
if (totalOps > 0) {
|
||||
for (const subResult of this.batchRefreshIndexResults(results)) {
|
||||
for await (const { desc } of codebaseIndex.update(
|
||||
tag,
|
||||
subResult,
|
||||
markComplete,
|
||||
repoName,
|
||||
)) {
|
||||
yield {
|
||||
progress: progress,
|
||||
desc,
|
||||
status: "indexing",
|
||||
};
|
||||
}
|
||||
completedOps +=
|
||||
subResult.compute.length +
|
||||
subResult.del.length +
|
||||
subResult.addTag.length +
|
||||
subResult.removeTag.length;
|
||||
progress =
|
||||
(completedIndexCount + completedOps / totalOps) *
|
||||
(1 / indexesToBuild.length);
|
||||
}
|
||||
completedOps +=
|
||||
subResult.compute.length +
|
||||
subResult.del.length +
|
||||
subResult.addTag.length +
|
||||
subResult.removeTag.length;
|
||||
progress =
|
||||
(completedIndexCount + completedOps / totalOps) *
|
||||
(1 / indexesToBuild.length);
|
||||
}
|
||||
|
||||
await markComplete(lastUpdated, IndexResultType.UpdateLastUpdated);
|
||||
completedIndexCount += 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import crypto from "node:crypto";
|
||||
import * as fs from "node:fs";
|
||||
import plimit from "p-limit";
|
||||
import { open, type Database } from "sqlite";
|
||||
import sqlite3 from "sqlite3";
|
||||
import plimit from "p-limit";
|
||||
import { IndexTag, IndexingProgressUpdate } from "../index.js";
|
||||
import { getIndexSqlitePath } from "../util/paths.js";
|
||||
import {
|
||||
|
|
@ -391,7 +391,7 @@ export async function getComputeDeleteAddRemove(
|
|||
lastUpdated,
|
||||
async (items, resultType) => {
|
||||
// Update tag catalog
|
||||
markComplete(items, resultType);
|
||||
await markComplete(items, resultType);
|
||||
|
||||
// Update the global cache
|
||||
const results: any = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue