Repository navigation
feat(connection): watch connections, and show what the pool is doing - #660
Merged
Merged
Conversation
ARCHITECTURE described a HealthChecker emitting connection_lost, and nothing emitted it. A tab whose server had gone looked exactly like one whose server was fine, right up until the next query failed with "Connection not found" — which says neither what happened nor when. There is one now: a task per connection pinging every 15 seconds, and backing off to FR-1.2.4's schedule — 1s, 2s, 4s, 8s, 16s, then 30s — from the first failure until one succeeds. The status bar turns its dot red, says "Lost — retrying (3)" and carries the server's own words in the title. Nothing is torn down in between: sqlx opens a fresh pooled connection when one is next asked for, so a server that comes back is usable again without the user doing anything. No jitter, deliberately. It exists to stop a thousand clients retrying in lockstep; a desktop client with a handful of connections has no herd to disperse. The task ends when the connection is removed from the manager, because the stop channel is owned by the entry — there is no second registry to keep in step. FR-1.2.3 also asked for pool statistics in the status bar. It shows `pool 3/5` now, amber when nothing is free, with a title saying what that means for the next query. And the pool fields took any number at all: a max of zero, which makes sqlx panic; a min above the max, which makes it refuse to build the pool; a five thousand that would open five thousand server threads. The dialog now says why, beside the field, and will not save. The backend clamps as well, so a profile stored by an older build still connects rather than failing at a number nobody can see. +18 Rust tests (5 live-server, on MySQL 8.0.46 and MariaDB 11.8), +19 frontend tests. One fix in passing: the command-contract test sliced the generated bindings at the first `\n}`, which an inline object type — what specta writes for an `Option<Struct>` — put in the middle, silently dropping every command after it from the check.
This was referenced Sep 12, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #276, #279.
The tab looked fine until the next query failed
ARCHITECTURE §3.1 described a
HealthCheckeremittingconnection_lost, and nothing emitted it. A connection whose server had gone looked exactly like a healthy one until someone ran a statement and got "Connection not found" — which says neither what happened nor when.There is one now: one task per connection,
SELECT 1every 15 seconds, backing off to FR-1.2.4's schedule — 1s, 2s, 4s, 8s, 16s, then 30s — from the first failed ping until one succeeds. The status bar turns its dot red, says "Lost — retrying (3)", and carries the server's own words in the title.Two decisions worth naming:
+ jitter(0–500ms). Jitter exists to stop a thousand clients retrying in lockstep. A desktop client with a handful of connections has no herd to disperse, and the doc now says so instead.The task ends when the connection is removed from the manager, because the stop channel is owned by the entry — no second registry to fall out of step with reality.
Pool statistics in the status bar (#279)
FR-1.2.3 asked for them and there were none. It shows
pool 3/5, amber when nothing is free, with a title saying what that means for the next query. Polled every three seconds rather than pushed: it changes with every query and nobody needs to know within the second.The error message half of #279 was already fixed — a pool timeout names the profile, the limit and what to change.
The pool fields took any number at all
A max of zero (sqlx panics), a min above the max (sqlx refuses to build the pool), a five thousand that would open five thousand server threads. The dialog now says why, beside the field, with
aria-invalidand a disabled Save. The backend clamps to 1–50 as well, so a profile stored by an older build still connects rather than failing later at a number nobody can see — with a warning in the log saying it did.Tests
+18 Rust (5 live-server, passing on MySQL 8.0.46 and MariaDB 11.8), +19 frontend. 2750 unit, 344 browser.
One fix in passing. The command-contract test sliced the generated bindings at the first
\n}— which an inline object type, what specta writes for anOption<Struct>, puts in the middle. Every command after that point was silently dropped from the check, which is how a contract test stops being one.