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

Method requeueFailedReferencesBinding

src/db/queries.ts:5602–5627  ·  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

5600 * starts with one of the names bound there (`N`, `N.run`).
5601 */
5602 requeueFailedReferencesBinding(language: Language, names: Map<string, Set<string>>): number {
5603 const files = [...names.keys()];
5604 const ids: number[] = [];
5605 for (let i = 0; i < files.length; i += SQLITE_PARAM_CHUNK_SIZE) {
5606 const chunk = files.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
5607 const rows = this.db
5608 .prepare(
5609 `SELECT id, file_path, reference_name FROM unresolved_refs
5610 WHERE status = 'failed' AND language = ? AND file_path IN (${chunk.map(() => '?').join(',')})`
5611 )
5612 .all(language, ...chunk) as Array<{ id: number; file_path: string; reference_name: string }>;
5613 for (const r of rows) {
5614 if (names.get(r.file_path)?.has(r.reference_name.split('.')[0]!)) ids.push(r.id);
5615 }
5616 }
5617 let changed = 0;
5618 this.db.transaction(() => {
5619 for (let i = 0; i < ids.length; i += SQLITE_PARAM_CHUNK_SIZE) {
5620 const chunk = ids.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
5621 changed += this.db
5622 .prepare(`UPDATE unresolved_refs SET status = 'pending' WHERE id IN (${chunk.map(() => '?').join(',')})`)
5623 .run(...chunk).changes;
5624 }
5625 })();
5626 return changed;
5627 }
5628
5629 /**
5630 * 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