Skip to content
Snippets Groups Projects
user avatar
dpsutton authored
* Verify active database for `GET api/health`

Previously unconditionally responded with 200, status "ok" if we were
done initializing, even when we had 1500 stale db connections
somehow (:scream:).

Now attempt to connect to the database:

```shell
❯ http get localhost:3000/api/health -pb
{
    "status": "ok"
}

❯ http get localhost:3000/api/health
HTTP/1.1 503 Service Unavailable
...
{
    "status": "Error getting db connection"
}
```

and logging to the server
```
2022-05-10 22:05:16,911 WARN server.routes :: Error in api/health database check
java.lang.ArithmeticException: Divide by zero
	at clojure.lang.Numbers.divide(Numbers.java:190)
	at clojure.lang.Numbers.divide(Numbers.java:3911)
	at metabase.server.routes$fn__122320.invokeStatic(routes.clj:51)
```

* Reuse `sql-jdbc.conn/can-connect-with-spec?` for api/health
0064e01c
History
Name Last commit Last update