fix(portal): degrade blocks instead of blocking the render when data-fair is down - #115
Merged
Conversation
…fair is down The ssr calls toward data-fair had no timeout — undici defaults to 300s — so a data-fair that answers slowly or not at all could hold a whole page render hostage, and the portal went dark even for pages that need no dataset. They now go through their own dispatcher, capped at 5s of inactivity, which also keeps their connection pool separate from the calls to our own services. Once such a fetch failed, a block used to render as if there was nothing to show: a catalog announcing "0 dataset", metrics at zero. Every block that takes its content from data-fair now renders a warning instead, and the page is served as a 503 with a Retry-After header, so a crawler comes back later rather than indexing a portal emptied of its datasets.
Nothing applies them on install — there is no postinstall hook, only the Dockerfile runs patch-package. A fresh worktree therefore ran on an unpatched vuetify, where the tab slider is a div instead of the span our patch makes it, and the e2e test covering that markup failed with no relation to the branch under work.
…ilable `unavailable` answers "should this block say it could not load", which is not the same question as "what went wrong": a consumer may still want the status code. Keeping both leaves the existing return untouched.
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.
When data-fair answers slowly or not at all, a portal goes dark: its ssr calls toward data-fair had no timeout — undici defaults to 300s — so one hanging call held a whole page render hostage, including pages that need no dataset. This restores the graceful degradation the v1 portals have, without giving up ssr rendering of the datasets, which is the whole point of indexing them.
Retry-After: 60, so a crawler comes back later rather than indexing a portal emptied of its datasets; the dataset and application pages get the same treatment, their 500 fallback becomes a 503useCatalogexposes anunavailableboolean next to its existing fetcherrorchore:dev/worktree.shrunsnpx patch-package, which nothing did on install — a fresh worktree ran on an unpatched vuetify and failed the tab slider e2e test, with no relation to the branch under workWhy: measured on opendata.edf.fr while data-fair was struggling — the portal served nothing, where a v1 portal (data.ademe.fr) still served its pages. The difference is not ssr, both render server side, but the absence of any timeout and a single connection pool shared by every service call.
Heads-up:
Retry-After— by hand against a data-fair returning 500, and by an e2e test for the client side navigation.page-error(404, 403) still wins.useCatalogbut keep their current behavior, silently empty: they query the portal API, not data-fair. One line each if we want them covered.uifiles are type plumbing for the shared components' auto-imports, no behavior change in the page editor.