fix(repoManager): Don't fetch files for each repo on validation (#414)

This commit is contained in:
Michael Sukkarieh 2025-07-31 17:50:04 -07:00 committed by GitHub
parent 48269781b7
commit e47fdb51db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -552,8 +552,8 @@ export class RepoManager implements IRepoManager {
return; return;
} }
const files = readdirSync(this.ctx.indexPath);
const reposToReindex: number[] = []; const reposToReindex: number[] = [];
for (const repo of indexedRepos) { for (const repo of indexedRepos) {
const shardPrefix = getShardPrefix(repo.orgId, repo.id); const shardPrefix = getShardPrefix(repo.orgId, repo.id);
@ -561,7 +561,6 @@ export class RepoManager implements IRepoManager {
// would need to know how many total shards are expected for this repo // would need to know how many total shards are expected for this repo
let hasShards = false; let hasShards = false;
try { try {
const files = readdirSync(this.ctx.indexPath);
hasShards = files.some(file => file.startsWith(shardPrefix)); hasShards = files.some(file => file.startsWith(shardPrefix));
} catch (error) { } catch (error) {
logger.error(`Failed to read index directory ${this.ctx.indexPath}: ${error}`); logger.error(`Failed to read index directory ${this.ctx.indexPath}: ${error}`);