Status engine
The Status engine shows a banner when the Davidnet services have a problem, so people know before they start to wonder.
- What it does
- Checks the Davidnet status page every minute while the tab is visible, and adds a banner for an incident, a maintenance or a service that is down.
- Exported from the package?
- No.
initStatusEngineandcheckStatusPageare not exported:initstarts them inside AppShell. For a message of your own useaddBannerof the Banner engine.
Which one do I use?
| What I need | Use |
|---|---|
| Start the check and the polling | initStatusEngine |
| Check once, now | checkStatusPage |
| Show a message of your own | addBanner |
initStatusEngine
// Not exported: init() starts it
function initStatusEngine(): void
async function checkStatusPage(): Promise<void>initStatusEngine() checks the status page at once and then every 60 seconds. It pauses while the tab is hidden and checks again as soon as the tab is visible. checkStatusPage() does one check. A running maintenance gives a warning banner. An incident, or a service of the group Required services that is down, gives a danger banner. Any other service that is down gives a warning banner. A new banner replaces the one of the previous check. It talks to status.davidnet.net and not to the backend, so it works when the backend is down and when no one is signed in.
When to use
Nothing: it needs no setup.
When not to use, and what to use instead
Do not call checkStatusPage in a loop: the engine already does. A check that fails is logged in the console and shows no banner, so no banner does not prove that everything works.
Live example
// Inside AppShell (init): start the check and the polling
initStatusEngine();
// Check once, now
await checkStatusPage();