mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
feat(core): Introduce DB health check (#10661)
This commit is contained in:
@@ -119,11 +119,17 @@ export abstract class AbstractServer {
|
||||
protected setupPushServer() {}
|
||||
|
||||
private async setupHealthCheck() {
|
||||
// health check should not care about DB connections
|
||||
// main health check should not care about DB connections
|
||||
this.app.get('/healthz', async (_req, res) => {
|
||||
res.send({ status: 'ok' });
|
||||
});
|
||||
|
||||
this.app.get('/healthz/readiness', async (_req, res) => {
|
||||
return Db.connectionState.connected && Db.connectionState.migrated
|
||||
? res.status(200).send({ status: 'ok' })
|
||||
: res.status(503).send({ status: 'error' });
|
||||
});
|
||||
|
||||
const { connectionState } = Db;
|
||||
this.app.use((_req, res, next) => {
|
||||
if (connectionState.connected) {
|
||||
|
||||
Reference in New Issue
Block a user