* Get the count of PENDING (never-attempted) references without loading * them into memory. Rows marked status='failed' — attempted by a completed * pass, no match — are excluded: they are not outstanding work, only retry * candidates for the #1240 sweep, so they must not trip the #1187 orp
()
| 4619 | * sweep or the `status` pending-refs warning. |
| 4620 | */ |
| 4621 | getUnresolvedReferencesCount(): number { |
| 4622 | if (!this.stmts.getUnresolvedCount) { |
| 4623 | // An index built before schema v8 (1.4.0 and older) has no `status`, |
| 4624 | // and the v8 migration marks every one of its rows pending. A read-only |
| 4625 | // open migrates nothing (`codegraph status`, #2913), so count them all |
| 4626 | // until a writer's open has migrated it. |
| 4627 | if (!this.hasSchema('unresolved_refs', 'status')) { |
| 4628 | return (this.db.prepare('SELECT COUNT(*) as count FROM unresolved_refs').get() as { count: number }).count; |
| 4629 | } |
| 4630 | this.stmts.getUnresolvedCount = this.db.prepare( |
| 4631 | "SELECT COUNT(*) as count FROM unresolved_refs WHERE status = 'pending'" |
| 4632 | ); |
| 4633 | } |
| 4634 | const row = this.stmts.getUnresolvedCount.get() as { count: number }; |
| 4635 | return row.count; |
| 4636 | } |
| 4637 | |
| 4638 | /** |
| 4639 | * Get a batch of PENDING unresolved references using LIMIT/OFFSET |
no test coverage detected