Skip to content

Commit

Permalink
fix: healthcheck at startup (#1544)
Browse files Browse the repository at this point in the history
  • Loading branch information
remy-auricoste authored Sep 30, 2024
1 parent 58af75d commit a9d5193
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion server/src/http/controllers/core.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const computeProcessorHealthCheck = async () => {
const health = await getProcessorHealthcheck()
const { workers } = health
const startedAtOpt = workers.at(0)?.task?.started_at
const error: boolean = !workers.length || Boolean(startedAtOpt && dayjs(startedAtOpt).isBefore(dayjs().subtract(6, "hour")))
const error: boolean = Boolean(startedAtOpt && dayjs(startedAtOpt).isBefore(dayjs().subtract(6, "hour")))
return {
...health,
error,
Expand Down
2 changes: 0 additions & 2 deletions server/src/http/healthcheck.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useMongo } from "@tests/utils/mongo.test.utils"
import { useServer } from "@tests/utils/server.test.utils"
import { addJob } from "job-processor"
import { describe, expect, it } from "vitest"

import { setupJobProcessor } from "@/jobs/jobs"
Expand All @@ -12,7 +11,6 @@ describe("healthcheckRoutes", () => {
const httpClient = useServer()
it("Vérifie que le server fonctionne", async () => {
await setupJobProcessor()
await addJob({ name: "db:validate", queued: false, payload: {} })
const response = await httpClient().inject({ method: "GET", path: "/api" })

expect.soft(response.statusCode).toEqual(200)
Expand Down

0 comments on commit a9d5193

Please sign in to comment.