* 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
()
| 4508 | * sweep or the `status` pending-refs warning. |
| 4509 | */ |
| 4510 | getUnresolvedReferencesCount(): number { |
| 4511 | if (!this.stmts.getUnresolvedCount) { |
| 4512 | // An index built before schema v8 (1.4.0 and older) has no `status`, |
| 4513 | // and the v8 migration marks every one of its rows pending. A read-only |
| 4514 | // open migrates nothing (`codegraph status`, #2913), so count them all |
| 4515 | // until a writer's open has migrated it. |
| 4516 | if (!this.hasSchema('unresolved_refs', 'status')) { |
| 4517 | return (this.db.prepare('SELECT COUNT(*) as count FROM unresolved_refs').get() as { count: number }).count; |
| 4518 | } |
| 4519 | this.stmts.getUnresolvedCount = this.db.prepare( |
| 4520 | "SELECT COUNT(*) as count FROM unresolved_refs WHERE status = 'pending'" |
| 4521 | ); |
| 4522 | } |
| 4523 | const row = this.stmts.getUnresolvedCount.get() as { count: number }; |
| 4524 | return row.count; |
| 4525 | } |
| 4526 | |
| 4527 | /** |
| 4528 | * Get a batch of PENDING unresolved references using LIMIT/OFFSET |
no test coverage detected