Repository navigation
Gateway details page: precomputed overviews, faster windows, no connection leak - #137
Open
bansalayush247 wants to merge 1 commit into
Open
bansalayush247 wants to merge 1 commit into
bansalayush247 wants to merge 1 commit into
Conversation
…iews The gateway page made two requests per load and the 90D window took up to 55 s. A background task now precomputes each federation's gateway list and uptime trend per window and serves both from /federations/:id/gateways/overview, so the page loads with one request in about a millisecond. - 24h/7D refresh every 5 minutes, 30D every 30, 90D hourly - activity CTEs are NOT MATERIALIZED (90D: 55 s to 4 s, same results) - gateways missing from the registry for 7 days count as retired and no longer drag uptime down; the page lists them separately - gateway polls are stored again (the window start parameter was inferred as an interval) - remove the old /gateways and /gateways/uptime-trend endpoints and the 1h window - /config/:invite/gateways reuses the observer's connector registry instead of building two per request, which left their guardian connections open - the page keeps its view in the URL, refreshes every minute, looks up the live registry in the background and counts gateways online for 15 minutes after they were seen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 11, 2026
This branch has not been deployed
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.
Summary
Makes the gateway details page fast and current, and stops the gateway fetch from leaking connections. The backend precomputes each federation's gateway list and uptime trend in the background and serves both from one endpoint. Scope is limited to gateway fetching and the gateway details page; it replaces #135, which also carried app-wide frontend changes.
Changes
Backend
/config/:invite/gatewaysbuilt a newConnectorRegistrytwice per request (config download and gateway fetch), and dropped registries keep their guardian connections open. It now reuses the observer's shared registry, like the background tasks already do.GET /federations/:id/gateways/overview?window=returns the gateway list and the uptime trend computed at the same moment, pluscomputed_at.?include=gatewaysor?include=trendreturns only that part.GET /federations/:id/gatewaysandGET /federations/:id/gateways/uptime-trend(unstable API, only used by our frontend) and the1hwindow, which the page never offered and is shorter than the 5-minute poll interval.NOT MATERIALIZED: the planner misestimated them as one row and nested-looped ~10k × 10k rows (90D: 55 s → 4 s, same results).timestamptzparameter was inferred asinterval, so every insert failed).Gateway details page
Testing
cargo clippy,tsc,eslintandnpm run buildpass./overviewanswers in ~1–2 ms for every window, and the page loads each window with one request and no console errors./config/:invite/gateways): before 31 → 291 (+260, about 26 per call); with this PR 16 → 17.Not in this PR
fetch_config_inner(/config/:invite) andtry_fetch_meta_inner(/config/:invite/meta) still build a registry per request and leak the same way. They aren't gateway code, so they're left for a separate change.🤖 Generated with Claude Code