Skip to content

fix(workspace): back off unreachable database diagnostics#746

Merged
psteinroe merged 3 commits into
mainfrom
fix/unreachable-db
May 27, 2026
Merged

fix(workspace): back off unreachable database diagnostics#746
psteinroe merged 3 commits into
mainfrom
fix/unreachable-db

Conversation

@psteinroe
Copy link
Copy Markdown
Collaborator

@psteinroe psteinroe commented May 25, 2026

Prevent DB-backed workspace operations from retrying a known-unreachable database connection on every edit. Connection failures are cached per connection key in the connection manager with exponential backoff, and DB callers now route through the manager so failures are tracked consistently.

Diagnostics Resilience

Database-backed file diagnostics are best-effort. When the database is unreachable, parser and static diagnostics are still returned instead of failing the whole edit-triggered diagnostics request.

Connection Manager Routing

DB-backed diagnostics, schema-aware static analysis, splinter, completions, hover, statement execution, and schema-cache invalidation now use ConnectionManager::with_pool, so connection failure backoff is managed centrally.

Regression Coverage

Added a workspace test that points at a closed local Postgres port, verifies static diagnostics are still produced, and confirms the second diagnostics pull during backoff completes quickly.

@psteinroe psteinroe requested a review from juleswritescode May 25, 2026 12:58
Copy link
Copy Markdown
Collaborator

@juleswritescode juleswritescode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — one concern: we're still using get_current_connection() a whole bunch in server.rs, for example when we fetch diagnostics or completions. We should probably migrate that to with_pool as well

@psteinroe psteinroe enabled auto-merge (squash) May 27, 2026 09:18
@psteinroe psteinroe merged commit aab1133 into main May 27, 2026
9 checks passed
@psteinroe psteinroe deleted the fix/unreachable-db branch May 27, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants