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. initStatusEngine and checkStatusPage are not exported: init starts them inside AppShell. For a message of your own use addBanner of the Banner engine.

Which one do I use?

What I needUse
Start the check and the pollinginitStatusEngine
Check once, nowcheckStatusPage
Show a message of your ownaddBanner

initStatusEngine

typescript
typescript
// 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

Result Last check: none Banners showing: 0
The first button really calls status.davidnet.net. A banner only shows up when there is something to report, which is not an error. It works the same signed in and signed out.
typescript
typescript
// Inside AppShell (init): start the check and the polling
initStatusEngine();

// Check once, now
await checkStatusPage();