fix(server): serialize SQLite access and validate storage health

This commit is contained in:
aj committed 2026-10-02 16:31:46 -04:00
1 parent b39509a6a3
commit 142c77a27f
5 files changed
+389 -54

No files matched your search

+3 -1
View File
@@ -33,7 +33,9 @@ var app = builder.Build();
// Open the database now so an unusable data path fails startup, not the first request.
app.Services.GetRequiredService<NestDatabase>();
app.MapGet("/healthz", () => Results.Ok(new { status = "ok" }));
app.MapGet("/healthz", (NestDatabase db) => db.IsHealthy()
? Results.Ok(new { status = "ok" })
: Results.Json(new { status = "unavailable" }, statusCode: StatusCodes.Status503ServiceUnavailable));
app.MapGet("/api/nests", (NestDatabase db) => Results.Ok(db.List()));