mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
fix(workouts): keep tracks and climb for accounts that already had them
Migration 0434 turns the route opt-in on for every account that already holds a stored workout track, so its tracks keep arriving after the upgrade; only accounts without one start off. Workouts stored before this release with a track but no elevation get their metres climbed written into Workout.elevationM by a one-time background pass. It runs detached at worker boot, reads one track at a time with a pause between batches of 100, and keeps its position in app_settings, so a restart resumes and a finished pass ends at once. The "starting" health reason is bounded: after five minutes the probe says plain degraded and the process logs one line, and the time the background role took to come up is logged either way. The compose healthcheck's ten-minute start period already keeps those probes from counting; its comment now says so.
This commit is contained in:
1 parent
846b0e5df0
commit
81e1f4cad1
11 files changed
+460
-12
No files matched your search
@@ -213,3 +213,19 @@ describe("GET /api/health while the background role starts", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /api/health — the `starting` window is bounded", () => {
|
||||
it("drops the reason once a start outlasts any real boot", async () => {
|
||||
const { markStartup, STARTING_MAX_MS } =
|
||||
await import("@/lib/boot/startup-state");
|
||||
vi.stubEnv("HEALTHLOG_PROCESS_TYPE", "web");
|
||||
markStartup("starting", Date.now() - STARTING_MAX_MS - 1_000);
|
||||
try {
|
||||
const { response, body } = await health();
|
||||
expect(response.status).toBe(503);
|
||||
expect(body).toEqual({ status: "degraded" });
|
||||
} finally {
|
||||
markStartup("ready");
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user