Serve static maintenance page with 503 when PocketBase is unreachable

This commit is contained in:
tleininger committed 2026-10-01 17:12:00 +02:00
1 parent ed6aa5d5ec
commit 7e56e83953
7 files changed
+500 -4

No files matched your search

+8 -4
View File
@@ -35,8 +35,8 @@ public partial class Home
private HttpContext? HttpContext { get; set; }
// Heading, intro and buttons come from the "home" page's body. Until it is loaded
// -- and for good if PocketBase is down -- the static fallback heading stands, so
// the start page always has a title.
// -- and for good if PocketBase fails during this request -- the static fallback
// heading stands, so the start page always has a title.
private HomeIntro _intro = HomeIntro.Fallback;
// The hero, the tiles and the next-event card are fixed structure of the start
@@ -53,8 +53,12 @@ public partial class Home
}
// Pages and events load side by side and fail on their own: without events the
// page loses only the card, without pages only text and tiles. Either way the
// start page stays a 200 rather than a 503 -- it is degraded, not broken.
// page loses only the card, without pages only text and tiles. A PocketBase that
// is plainly down never gets this far -- the maintenance gate in Program.cs
// answers with maintenance.html first. These catches are the second line: the
// gate's health result is cached for a few seconds, so PocketBase can fail between
// that check and these reads. Without them that would be a 500; with them the
// start page stays a 200 rather than a 503 -- degraded, not broken, and rare.
private async Task LoadPagesAsync(CancellationToken token)
{
try