refactor: dedupe busy/locked error detection into isBusyOrLockedError#1860
Closed
carlos-alm wants to merge 1 commit into
Closed
Conversation
Extracts the /\b(busy|locked|SQLITE_BUSY|SQLITE_LOCKED)\b/i regex check into a single isBusyOrLockedError(msg) helper, replacing the identical inline check duplicated between openRepo's native path (tryOpenRepoNative) and openReadonlyWithNative's native path. No change to matching behavior or the busy_timeout value. DEFAULTS.db.busyTimeoutMs (this issue's other flagged cleanup) was already added and wired into openDb/openReadonlyOrFail by an earlier commit in this stack (8f23020); this commit covers the remaining regex duplication only. docs check acknowledged: internal dedup-only refactor, no CLI surface, language support, or documented architecture/design decision changed. Fixes #1749 Impact: 3 functions changed, 27 affected
Contributor
Contributor
Codegraph Impact Analysis3 functions changed → 27 callers affected across 21 files
|
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DEFAULTS.db.busyTimeoutMsregistration was already done by an earlier commit in this batch (PR fix: address quality issues in builder pipeline, config, and db connection handling #1788) — confirmed no hardcoded'busy_timeout = 5000'literal remains./\b(busy|locked|SQLITE_BUSY|SQLITE_LOCKED)\b/iinline in bothtryOpenRepoNativeandopenReadonlyWithNative's catch blocks — extracted into a sharedisBusyOrLockedError(msg)helper. Regex behavior unchanged.Closes #1749
Test plan
npm test— full suite green (3490 passed, 0 failed)npm run lint— cleancodegraph diff-impact --staged -T— 3 functions changed, 27 callers affected, consistent with a non-behavioral helper extractionFor #1763's benefit: confirmed
crates/codegraph-core/src/db/connection.rshas the identical hardcodedbusy_timeout = 5000literal duplicated at two call sites (open_read_write,open_readonly). No Rust equivalent of the busy/locked regex exists — rusqlite surfacesSQLITE_BUSY/SQLITE_LOCKEDas typed error variants, not string matching.Stacked on #1859 (base branch
fix/issue-1748-connection-halstead-effort) — only the connection.ts diff is this issue's change.