MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / requeueFailedReferencesBinding

Method requeueFailedReferencesBinding

src/db/queries.ts:5491–5516  ·  view source on GitHub ↗

* Re-queue a language's parked failures in `names`' files whose reference * starts with one of the names bound there (`N`, `N.run`).

(language: Language, names: Map<string, Set<string>>)

Source from the content-addressed store, hash-verified

5489 * starts with one of the names bound there (`N`, `N.run`).
5490 */
5491 requeueFailedReferencesBinding(language: Language, names: Map<string, Set<string>>): number {
5492 const files = [...names.keys()];
5493 const ids: number[] = [];
5494 for (let i = 0; i < files.length; i += SQLITE_PARAM_CHUNK_SIZE) {
5495 const chunk = files.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
5496 const rows = this.db
5497 .prepare(
5498 `SELECT id, file_path, reference_name FROM unresolved_refs
5499 WHERE status = 'failed' AND language = ? AND file_path IN (${chunk.map(() => '?').join(',')})`
5500 )
5501 .all(language, ...chunk) as Array<{ id: number; file_path: string; reference_name: string }>;
5502 for (const r of rows) {
5503 if (names.get(r.file_path)?.has(r.reference_name.split('.')[0]!)) ids.push(r.id);
5504 }
5505 }
5506 let changed = 0;
5507 this.db.transaction(() => {
5508 for (let i = 0; i < ids.length; i += SQLITE_PARAM_CHUNK_SIZE) {
5509 const chunk = ids.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
5510 changed += this.db
5511 .prepare(`UPDATE unresolved_refs SET status = 'pending' WHERE id IN (${chunk.map(() => '?').join(',')})`)
5512 .run(...chunk).changes;
5513 }
5514 })();
5515 return changed;
5516 }
5517
5518 /**
5519 * Return a language's parked (status='failed') refs to the pending set —

Callers 1

Calls 9

mapMethod · 0.80
hasMethod · 0.80
pushMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65
getMethod · 0.65
transactionMethod · 0.65
runMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected