Skip to content

Commit

Permalink
feat(health-check): implement health check, add log
Browse files Browse the repository at this point in the history
  • Loading branch information
yossi-eynav committed Feb 20, 2024
1 parent a52812c commit 77a902b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/api/service/database.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const Config = require('../lib/config');
const log = require('../lib/log')

const Knex = require('knex');

Expand All @@ -19,9 +20,10 @@ BookshelfConnection.plugin(require('../lib/bookshelf-mysql-gis'));

async function isHealthy() {
try {
await KnexConnection.select("select 1")
await KnexConnection.raw("select 1")
return true
} catch(e) {
log.error({ message: "Knex is uhealthy", error: e, })
return false;
}

Expand Down

0 comments on commit 77a902b

Please sign in to comment.